Story highlights U.S. State Department says both crews successfully handled the situation

American sailors have helped Iranians at sea in the past

The incident occurred close to the Strait of Hormuz

Piracy is a major problem for international shippers

Iranian sailors helped scare off armed pirates who attacked an American cargo ship in the Gulf of Oman, Iranian state media reported Thursday.

It's the latest example of U.S.-Iranian cooperation on pirate-infested high seas despite a wave of tensions between Washington and Tehran over the decades.

The incident occurred northeast of Fujairah, a port for refueling oil tankers, the Fars News Agency said. The port, in the United Arab Emirates, is close to the Strait of Hormuz, an important oil shipping lane.

JUST WATCHED Surviving a pirate attack Replay More Videos ... MUST WATCH Surviving a pirate attack 02:35

Iranian navy vessels received a distress signal from the U.S. cargo ship Maersk Texas during patrols.

The forces announced their willingness to help. As they closed in on the American cargo ship, the pirates scattered. The U.S. ship crew thanked the Iranian naval force and continued on its way, state media reported.

"We were aware of the incident yesterday," a State Department official said. "The situation was successfully deescalated by the ship's crew and the Iranian crew."

The United States, Iran and other nations have been intent on repelling pirates operating in the Gulf of Aden and other bodies of water.

American forces assisted or rescued Iranians at sea several times in January.

Tehran has threatened to close the the strait if sanctions are imposed on its exports of crude oil. The West has been using sanctions and diplomacy to try to stop Iran from producing nuclear weapons.