The U.S. aircraft carrier USS Harry S Truman was about 1,500 yards from an Iranian rocket in the Strait of Hormuz last week. REUTERS

An Iranian missile missed the U.S. aircraft carrier USS Harry S Truman by about 1,500 yards in the Strait of Hormuz last week, two U.S. military officials told NBC News. Iranian Revolutionary Guards were running a live-fire exercise Saturday near the Truman, according to officials.

At the time, the American carrier was traversing the slender waterway, which links the Arabian Sea to the Persian Gulf. The Iranian navy began firing in the area as the carrier neared the end of the strait, shooting several "unguided" missiles into the area, officials said. The Truman was not in territorial waters at the time.

Even though the missiles were not directed at the U.S. vessel, the officials said the exercise was "unnecessarily provocative and unsafe." There had also been another U.S. vessel - the destroyer USS Buckley -- in the area, as well as a French frigate and other commercial ships.

The Strait of Hormuz is one of the world's most important oil shipping channels. The military official said the U.S. ships had been in "internationally recognized maritime traffic lane" when the Iranian navy began its live-fire exercise. Prior to the exercise, the Iranian navy announced over maritime radio its plans for missile practice.

The Truman continued transit and is now positioned in the Gulf, where it is launching aircraft in support of Operation Inherent Resolve, the U.S. campaign against the Islamic State group in Iraq and Syria. It is unclear if Iranian and American officials have communicated regarding the incident.

Last April, a cargo ship was seized by Iranian patrol vessels in the Strait of Hormuz while traveling to the United Arab Emirates port of Jebel Ali. Iran fired warning shots at the cargo ship for "trespassing." Earlier reports indicated the ship was American, but a Pentagon spokesperson told Reuters it was a Marshall Islands-flagged ship. The official said U.S. planes and a destroyer monitored the situation after the Islamic Revolutionary Guards intercepted and boarded the ship.