WASHINGTON — Iran successfully put into orbit what it called its first “military satellite” on Wednesday, after a string of previous failures, just hours before President Trump declared he had instructed the Navy to sink any Iranian fast boats that “harass our ships at sea.” The order, if followed, could sharply escalate the confrontations between the two nations.

While Iran was vague about the military capabilities of the satellite, the launch was notable in part because it originated from a mobile launch vehicle, similar to the kind the North Koreans are using to demonstrate they have the ability to roll out a missile and send it into space before the United States or its allies have time to respond. Secretary of State Mike Pompeo immediately condemned the launch as a violation of a United Nations Security Council resolution and declared that Iran would be “held accountable,” but did not specify what that meant.

As the C.I.A. director, Mr. Pompeo ordered an acceleration of a secret American program to sabotage Iranian launches. But after a string of major failures, the launch on Wednesday marked an unusual success, one Iranian television hailed with pictures of officers from the Islamic Revolutionary Guards Corps, many wearing masks, in a celebration in a control room.

The president’s abrupt tweet authorizing a far looser standard for the Navy to fire on Iranian fast boats seemed to take the Pentagon by surprise. Under the Navy’s rules of engagement, lethal force can be used only if American ships or personnel are put at risk — for example, by trying to ram a U.S. warship or place explosives near its hull. But blaring loudspeakers and weaving in the ship’s path, all part of the standard harassment techniques used by swarms of Iranian small boats, are not considered legally sufficient to open a salvo that could escalate into war.