Donald Trump called his critics 'fools' on Thursday after signing a deal with Iran that ended the Middle East war and sent oil prices plunging more than three percent.

The US president put his name to the agreement at a candlelit dinner with French President Emmanuel Macron inside the Palace of Versailles on Wednesday — the same palace where the treaty ending World War I was signed. Macron shouted 'bravo' as Trump signed.

"These fools, who think I haven't been tough enough on Iran, when the Stock Market Just Hit A RECORD HIGH, and Oil prices are 'tumbling' down, are either jealous, bad people, or stupid," Trump posted on social media hours after the signing.

Iranian President Masoud Pezeshkian also signed the accord, according to foreign ministry spokesman Esmaeil Baqaei. "Now it's time to test the implementation of the agreement," Baqaei said.

"These fools, who think I haven't been tough enough on Iran, when the Stock Market Just Hit A RECORD HIGH, and Oil prices are 'tumbling' down, are either jealous, bad people, or stupid."

The deal should end the five-week all-out war between the US-Israeli forces and Iran that began in early April. The conflict had severely restricted shipping through the Strait of Hormuz, a narrow waterway that handles about a fifth of the world's oil supply, causing energy prices to spike.

Pakistan's Prime Minister Shehbaz Sharif, who helped mediate the agreement, said the deal "shall enter into force with immediate effect" and that Iran "will instantly reopen the Strait of Hormuz." Sharif also signed the accord.

A two-month negotiating period now begins. The talks will focus on reopening the strait and making progress on Iran's nuclear programme, which Washington has long suspected of hiding bomb-making ambitions.

Macron hailed the deal "which allows for peace, the reopening of the Strait of Hormuz without tolls, and 60 days to conclude an agreement on nuclear, ballistic, and regional activities."

Under the deal's text, Washington commits to immediately waive oil sanctions that have been crippling Iran's economy. Once a final agreement is reached on Iran's nuclear programme, the US will also help release a $300 billion reconstruction fund supported by regional nations.

UN atomic agency chief Rafael Grossi told reporters in Geneva that his agency is ready to begin defining the "concrete steps" needed to implement the deal. US officials said Iran will dilute its enriched uranium stocks, possibly by "down-blending on site" under UN supervision.

Iran's ballistic missile programme wasn't mentioned in the agreement, despite Israel's long push for its dismantlement. "Iranian missiles are only for firing, not for negotiations. Iran's defence capability won't be discussed in any way, in any process or with any party," Baqaei said.

There was confusion over the next steps. The accord was originally supposed to be signed on Friday at a mountain-top resort in Switzerland by Iran's chief negotiator and parliament speaker, Mohammad Bagher Ghalibaf, and US Vice President JD Vance. Baqaei said an in-person ceremony wasn't needed. But Sharif said an official ceremony will take place on Friday in Switzerland, where technical talks will begin.

For Macron, hosting the signing at Versailles was a huge win after his hosting of the G7 summit. The palace was where the Treaty of Versailles was signed in 1919, ending World War I.

Oil prices fell more than three percent on Thursday, extending losses since news of the deal broke over the weekend. The reopening of the Strait of Hormuz is expected to bring more oil to global markets, further pushing down prices.