Trump vowed a "swift and vigorous response" if the ICC tried to prosecute Israelis or Americans, following a call from the Palestinians to investigate Israeli action in the West Bank and Gaza Strip.
"Any attempt to target American, Israeli, or allied personnel for prosecution will be met with a swift and vigorous response," Trump said in a statement issued after the ICC rejected a request to open a war crimes probe against US troops in Afghanistan.
"This is a major international victory, not only for these patriots, but for the rule of law," Trump said.
"We welcome this decision and reiterate our position that the United States holds American citizens to the highest legal and ethical standards."
Rights groups denounced the judges' decision as a blow for thousands of victims in the long-running Afghan conflict and warned it could embolden perpetrators around the world to act with impunity.
It is "a devastating blow for victims who have suffered grave crimes without redress," said Param-Preet Singh, the international justice associate director of Human Rights Watch.
"This sends a dangerous message to perpetrators that they can put themselves beyond the reach of the law just by being uncooperative."
ICC prosecutors in 2006 opened a preliminary investigation into war crimes and crimes against humanity committed in Afghanistan since 2003.
In 2017, chief prosecutor Fatou Bensouda asked judges to allow a full-blown probe not only into the Taliban and Afghan soldiers, but also international forces, particularly US troops and members of the Central Intelligence Agency.
Angered, Trump's administration said it would deny visas to any ICC members involved in probing US troops and, last week, it revoked the visa of the Gambian-born Bensouda.
The ICC is currently investigating Israeli actions in the West Bank and Gaza including the demolition of Palestinian property and eviction of Palestinians from the West Bank and East Jerusalem.
Bensouda said in October that "extensive destruction of property without military necessity and population transfers in an occupied territory constitute war crimes" under the Rome Statute treaty that established the ICC.
Agencies contributed to this report.
Follow us on Twitter: