Iran’s Foreign Ministry on Saturday welcomed the U.S. Navy’s rescue of 13 Iranian fishermen held captive by pirates, just days after it had warned all U.S. ships to leave the region.

U.S. officials announced Friday that the fishermen had been rescued by a Navy destroyer the day before, more than 40 days after their boat was commandeered by suspected Somali pirates in the northern Arabian Sea.

On Tuesday, Tehran told the United States to keep the carrier strike group to which the destroyer belonged out of the Persian Gulf. Iran is preparing to send naval vessels to the Gulf of Mexico in a few months, officials have said.

But the Foreign Ministry, which is headed by an ally of President Mahmoud Ahmadinejad, broke an initial silence Saturday, welcoming the rescue and saying it set an example for other countries.

“The rescue of Iranian sailors by American forces is considered a humanitarian gesture, and we welcome this behavior,” ministry spokesman Ramin Mehmanparast was quoted as saying by state TV’s al-Alam Arabic-language channel.

“We think all nations should display such behavior,” he said.

The response marked a letup after weeks of rising tensions between Iran and the United States, which is leading efforts to implement a boycott of Iranian oil. In response, Iran’s navy started war games last month during which it threatened to close the strategic Strait of Hormuz, the Persian Gulf gateway for about 30 percent of the world’s oil and gas.

Iran’s semiofficial Fars news agency criticized the rescue operation, saying the United States had staged a Hollywood-style dramatization of a routine event. U.S. officials called special news conferences and had several spokesmen comment on the event.

“Iran’s navy has rescued various foreign ships from the hands of pirates . . . but never publicized that,” Fars wrote. The agency, which has ties to Iran’s elite Revolutionary Guard Corps, has, in fact, often published stories about Iran’s navy rescuing foreign vessels from pirates.