(CNN) -- U.S. sailors from a carrier strike group whose recent presence in the Persian Gulf drew the ire of Iranian military officials have rescued 13 of the Middle Eastern country's sailors from a hijacked fishing boat, a military spokesman said Friday.
The destroyer USS Kidd came to the aid of the ship Thursday in the North Arabian sea, near the crucial Strait of Hormuz, according to the Navy.
The rescue prompted the captain of the freed ship to offer his "sincere gratitude," according to Josh Schminky, a Navy Criminal Investigative Service agent aboard the Kidd.
"He was afraid that without our help, they could have been there for months," Schminky said.
The rescue Thursday came two days after Iran said the United States should not send any more warships into the Persian Gulf.
The USS John Stennis Strike Group, which includes the Kidd, moved out of the Gulf through the Strait of Hormuz last week, prompting Iranian Brig. Gen. Ahmad Vahidi to warn that "there is no need for the forces belonging to the countries beyond this region to have a presence in the Persian Gulf," according to the semi-official Fars News Agency.
"Their presence does nothing but create mayhem, and we never wanted them to be present in the Persian Gulf," Vahidi said.
According to the Navy, a helicopter from the Kidd spotted a suspect pirate boat alongside the Iranian vessel. At the same time, the Kidd received a distress call from the captain of ship, the Al Molai, saying he and his crew were being held captive by pirates.
A team from the Kidd boarded the Al Molai, took 15 suspected pirates into custody and freed 13 Iranian hostages, the Navy said.
The suspected pirates, mostly Somalis, were taken to the Stennis to be held until a decision is made about prosecution, Pentagon spokesman Capt. John Kirby said Friday.
Pirates hijacked the Al Molai 40 to 45 days ago, U.S. Naval Forces Central Command said in a statement. The crew was "held hostage, with limited rations and we believe were forced against their will to assist the pirates with other piracy operations," according to the statement.
The Navy team provided food, water and medical care to both the suspected pirates and the crew of the Al Molai after securing the ship and ensuring everyone was safe, Schminky said.
The crew had "been through a lot," he said.
"We went out of our way to treat the fishing crew with kindness and respect," he said.
Secretary of Defense Leon Panetta called the USS Stennis later Friday to congratulate the strike group commander, Rear Adm. Craig Faller, and his team on a "well executed effort," the Pentagon said.
"He said the team did exactly the right thing, and that he's proud of what they were able to do," Pentagon spokesman George Little said in a release.
He quoted Panetta as saying, "When we get a distress signal, we're going to respond. That's the nature of what our country is all about."
CNN's Charley Keyes contributed to this report.