President Donald Trump on Wednesday pledged that the US would bomb Iranian civil infrastructure every time Tehran fires at ships in the strategic Strait of Hormuz.

"From this point forward, any time the Islamic Republic of Iran shoots at a ship in the Strait of Hormuz, whether it be by missile, rocket, drone, or any other device or weapon, the United States will bomb and destroy one bridge or power plant," Trump wrote on his Truth Social network.

Trump said this included Iranian facilities "located next to, or in, the capital city of Tehran."

Trump's threat came shortly before he headed to an airbase for the return of the remains of three US troops killed in Iranian attacks on US military facilities in the Gulf.

The US president said he was going to "honour our heroes and they're indeed great heroes."