A senior defense official told Fox News that an Iranian cargo ship bound for Yemen changed course early Thursday morning local time (10 p.m. ET Wednesday) and is now steaming in the direction of Djibouti to offload its cargo as the Pentagon and United Nations had requested, avoiding for now a potential deadly confrontation with Iran.

Iranian officials had claimed its cargo ship "Iran Shahed" was only ferrying humanitarian aid to war-torn Yemen and not weapons. Pentagon officials said the ship did not appear to have nefarious intentions, citing the presence of reporters and peace activists on the ship as evidence. Earlier this week, the Pentagon revealed that two Iranian warships were escorting Shahed as well.

Iranian officials had warned through its state-run media that the cargo ship and Navy escorts would drop off its cargo in Hodeida, Yemen on the coast of the Red Sea, not Djibouti.

The Pentagon confirmed that a U.S. Navy Amphibious Ready Group, comprised of six U.S. Navy warships, carrying up to 2,000 U.S. Marines and helicopters to transport them, were in the area ready to respond. USS Iwo Jima and USS New York were "not far" from Shahed and the two Iranian warships when she changed course earlier today, according to an official.

This is the second time an Iranian cargo ship bound for Yemen in defiance of a Saudi-led blockade has reversed course in the past month.

A nine-ship Iranian convoy left Iran last month blazingly displaying rockets on its decks and escorted by two Revolutionary Guard Corps missile boats, prompting the Pentagon to order an aircraft carrier out of the Persian Gulf to intercept the convoy off the coast of Oman. That nine-ship convoy reversed course and returned to its home port of Bandar Abbas a short time after planes from the USS Theodore Roosevelt showed up.

A Pentagon official told Fox News that there has been increased Iranian activity in the Persian Gulf since its Iranian Revolutionary Guard Corps Navy vessels last week fired warning shots and later attempted to disable a Singapore-flagged tanker vessel Alpine Eternity, chasing her into Emerati waters before breaking off pursuit. Iranian officials said it was settling a legal dispute after Alpine Eternity hit an Iranian state owned oil rig in the Persian Gulf in late March.

"Nobody is firing shots at the moment, but IRGCN vessels are making their presence felt," he said using an acronym for the Iranian Revolutionary Guard Corps Navy.

In early May, Iran released a Marshall Islands-flagged cargo ship, Maersk Tigris, seized in the Persian Gulf using similar tactics-firing warning shots and ordering the ship to change course. In that case, the skipper complied with the Revolutionary Guard's orders and sailed the ship to Iranian waters in another legal dispute -- this time over lost cargo in the United Arab Emirates dating back to 2005.

Lucas Tomlinson is the Pentagon and State Department producer for Fox News Channel. You can follow him on Twitter: @LucasFoxNews