The United States has told its citizens to leave Iran immediately, warning that hostilities across the Middle East could escalate rapidly, as Iran said tankers were hitting naval mines in the Strait of Hormuz on Wednesday.

"Do not travel to Iran for any reason. United States citizens should leave Iran immediately," the U.S. Virtual Embassy in Iran said in a security alert issued on Tuesday and reported widely on Wednesday. The alert said Iran, Yemen's Houthi movement and other groups aligned with Tehran may target U.S. citizens, companies and institutions, and warned Americans across the region to exercise heightened vigilance.

The warning followed Iranian attacks on U.S. facilities in Bahrain and Kuwait last week and a Houthi strike on a tower in Riyadh's financial district on Tuesday that wounded 11 people, according to Saudi authorities. The State Department is maintaining its highest travel advisory for Iran, Level 4: Do Not Travel. The United States has had no embassy in Tehran since diplomatic ties were cut in 1980; Switzerland represents American interests there.

Americans in the region were urged to monitor airline and airport operations, prepare for flight cancellations and airspace closures, avoid demonstrations and large gatherings, and enrol in the State Department's Smart Traveler Enrollment Program. The alert also warned that rules for crossing Iran's land borders could change at short notice.

The warning came as Iran's Revolutionary Guards Navy said two oil tankers struck naval mines early on Wednesday off the southern and eastern coasts of the Strait of Hormuz, exploding and catching fire in their engine rooms. The force said the tankers had switched off their navigation and positioning systems and were trying to transit what Tehran calls an unauthorised route through the strait.

Later on Wednesday, Iran said a third vessel, a ship carrying liquefied natural gas, also hit a mine and caught fire in the strait. Arab News reported the claim, carried by Iranian state media, and noted that Reuters could not independently verify it. Iran had earlier said three tankers struck mines on Monday and that an oil tanker and a container ship hit mines on Tuesday.

Iran tightened security and transit restrictions across the strait on February 28, barring safe passage to vessels belonging to or affiliated with Israel and the United States in retaliation for joint military strikes on Iranian territory. The number of attacks in the waterway soared in October to the highest level since the Iran war began at the end of February, according to data compiled by Bloomberg.