WASHINGTON — We spy — but so do they, the head of the National Security Agency told Congress Tuesday.

Appearing before the House Intelligence Committee for the first time since leaked classified documents revealed US snooping on foreign allies, NSA boss Keith Alexander said those same allies are currently spying on the United States.

He said his statement applied to the European Union — where the United States monitored the leaders of friendly nations, including France and Germany.

Alexander added that Russia and China were also spying on the United States and its top officials.

“Some of this reminds me a lot of the classic movie, Casablanca — My God, there’s gambling going on in here?” said Director of National Intelligence James Clapper, shrugging off outrage in Europe over the US actions.

Alexander’s appearance came just days after German Chancellor Angela Merkel phoned President Obama to complain about news reports that US surveillance had targeted her personal cellphone.

The Wall Street Journal, citing US officials, said Tuesday that France and Spain provided intelligence data to the United States that led to the most recent uproar.