See United States v. Greathouse, et al.If you are not a US citizen and not in the sovereignty of the US you are in the clear.
If you are not in the soverign territory of the US you are in the clear.
If there is no state of war, you may be in the clear regardless.
A foreigner is likely not guilty unless caught and then up to the prosecutor.
Alfred Rubery, an English subject, was convicted of treason and subsequently pardoned by Abraham Lincoln.