Quick search by citation:

33 U.S. Code § 1483 - Foreign government ships; immunity

No measures may be taken under authority of this chapter against any warship or other ship owned or operated by a country and used, for the time being, only on Government noncommercial service.