Already in 2002 US passed the "American Service-Members' Protection Act" that allows USA to deploy military to prevent U.S. or allied officials and military personnel from being prosecuted or detained by the ICC.
It passed via bypartisan vote well in time before US launched the illegal invasion of Iraq in which it committed various war crimes.
https://en.wikipedia.org/wiki/American_Service-Members%27_Pr...