WASHINGTON — Secretary of State Mike Pompeo warned Iran on Thursday against launching three spacecraft in the coming months, describing them as a cover for testing technology that is necessary to lob a warhead at the United States and other nations.

His statement seemed intended to build a legal case for diplomatic, military or covert action against the Iranian missile program. It was surprising only because Iran has been launching modest space missions, mostly to deploy satellites, since 2005.

Around the time that Mr. Pompeo issued the statement, a 12-year-old Iranian satellite that was launched by Russia was circling the globe, including in a path that took it close to New York. And Mr. Pompeo made no mention of the other country that, over the years, has aided Iran’s ballistic missile and space rocket program: North Korea, whose leader was praised by President Trump as recently as Wednesday for writing him a “beautiful letter.”

The stark warning on Thursday was immediately rejected by Foreign Minister Mohammad Javad Zarif of Iran, who shot back in a tweet that Tehran’s launch of space vehicles — and of missiles — is “NOT in violation of Res 2231.” He was referring to the United Nations resolutions approved in 2015, shortly after the completion of the Iran nuclear deal.