Senior U.S. military commanders on Wednesday accused Iran's military of “highly provocative” actions in firing unguided rockets 1,500 yards from ships including an American aircraft carrier.

The USS Harry S. Truman was crossing international waters in the Strait of Hormuz when Iranian Revolutionary Guards (IRCGN) conducted a live-fire exercise right nearby, according to a statement.

An Iranian navy attack craft fired several unguided rockets near the carrier, officials said. A French frigate, the U.S. destroyer USS Bulkeley and other commercial traffic were also in the area at the time of Saturday's incident.

Only 23 seconds warning was given before the weapons were fired, according to U.S. Navy Cmdr. Kyle Raines, a spokesman for U.S. Central Command.

The rockets were not fired at the Truman and other ships, and there were no direct communications between U.S. and Iranian navies, military officials said.

“The IRGCN's actions were highly provocative,” Cmdr. Kevin Stephens, spokesman for the U.S. Fifth Fleet, said Wednesday in a statement.

“Firing weapons so close to passing coalition ships and commercial traffic within an internationally recognized maritime traffic lane is unsafe, unprofessional, and inconsistent with international maritime law.”

Nobody from Iran's foreign or defense ministries gave official comment, but the country's state-run news agency, Fars, said in its report of the event that no vessel was in danger.

The incident was a planned training exercise and all vessels in the area had been warned, it said.

The official said the U.S. ships were in the "internationally recognized maritime traffic lane" at the time, not in any territorial waters, when the Iranian navy announced over maritime radio that it was about to conduct a live-fire exercise and asked other vessels to remain clear.

After the warning, the rockets were fired from a position about 1,500 yards off the carrier's starboard side and in a direction away from passing coalition and commercial ships and the traffic lane, the official said. The rockets were not fired at the Truman and other ships, only near them.

Aircraft Carrier U.S.S. Harry S. Truman steams underway on March 29, 2003 in the Eastern Mediterranean Sea. U.S. Navy / Getty Images File

While the official said the Iranians were "clearly not" targeting ships, the action was "unnecessarily provocative and unsafe."

There were no direct communications between U.S. and Iranian navies, the official said.

Coalition forces continued transiting without any further incident, the official said, adding that the Truman is now in the Gulf and launching aircraft in support of Operation Inherent Resolve.

Nobody from Iran’s foreign or defense ministries gave official comment, but the country’s state-run news agency, Fars, said in its report of the event that no vessel was in danger.

The incident was a planned training exercise and all vessels in the area had been warned, it said.