The foreign secretary, Jeremy Hunt condemned the attacks but called for a diplomatic solution. He said: These latest attacks build on a pattern of destabilising Iranian behaviour and pose a serious danger to the region. It is essential that tankers and crews are able to pass through international waters safely. We call on Iran urgently to cease all forms of destabilising activity. The UK remains in close coordination with international partners to find diplomatic solutions to de-escalate tensions.”

With oil prices rising and warnings of an unintended war between Washington and Tehran proliferating, Trump vowed the US would ensure the narrow Strait of Hormuz would be kept open for oil traffic. The two-mile stretch of waterway is seen by Iran as sovereign waters.

“They’re not going to be closing it. It’s not going to be closed, it’s not going to be closed for long and they know it. They’ve been told in very strong terms,” Trump told Fox News.

He added: “Iran did do it. You know they did it because you saw the boat. I guess one of the mines didn’t explode and it’s probably got essentially Iran written all over it … You saw the boat at night, successfully trying to take the mine off – and that was exposed.”

On Thursday he said any plans for talks over the nuclear deal were off, despite a mediation visit to Tehran this week by the Japanese prime minister, Shinzo Abe. But on Friday Trump said he was open to discussions and wanted to get Iran round the table. Abe personally debriefed Trump after his trip.

Another mediator, the Iraqi prime minister, Adel Abdul-Mahdi, called the US secretary of state, Mike Pompeo, to urge Washington to lower the temperature.

Iran has insisted it would not have attacked the two ships during Abe’s visit since both ships had connections with Japan. Iran’s foreign minister, Mohammad Javad Zarif, tweeted that the US had “immediately jumped to make allegations against Iran without a shred of factual or circumstantial evidence”. He accused Washington of seeking to “sabotage diplomacy”.

The Iranian ambassador to the UK, Hamid Baeidinejad, said the western intelligence claims were similar to “false fabrications during World War I, the Vietnam war and Iraq war that were designed to instigate military interventions and armed conflicts in different parts of world.”

Saudi Arabia’s energy minister, Khalid Al-Falih, said the kingdom was monitoring the situation with “great concern”. A statement said he “called upon the international community to assume its joint responsibility and take firm action to secure maritime traffic in the region’s waterways”.

Saudi Arabia, a close US ally, is a bitter regional rival of Iran and has been accused by some critics of encouraging Washington to pursue a confrontation with the Iranian leadership.

Other world powers called for calm. China urged all sides to “resolve the conflict through dialogue”, while the European Union called for “maximum restraint”. Russia, which has close if sometimes strained links to Iran, warned against “hasty conclusions”.

The oil tankers that came under attack were 10 nautical miles apart and heading to Asia when they were struck by explosions in the early hours of Thursday after passing through the Strait of Hormuz 25 nautical miles off Iran’s southern coast.

The Front Altair was carrying naphtha, a refined petroleum product, and is owned by Frontline, an Oslo-listed company. It was hit by three explosions, according to Norwegian officials.

Explosions also struck the Japanese-owned Kokuka Courageous, which was loaded with methanol. The fire onboard was soon extinguished. On Friday the ship was heading towards the UAE port of Khor Fakkan.

In Tokyo, the owner of the Kokuka Courageous said its sailors saw “flying objects” before the attack, suggesting it was not damaged by mines. The company’s president, Yutaka Katada, offered no evidence for his claim, which contradicted the US military account.

Katada also said crew members saw an Iranian naval ship nearby, but he did not specify whether this was before or after the attacks.