U.S. President Donald Trump said Wednesday he signed an agreement with Iran that U.S. officials say calls for Tehran to dilute its stockpile of highly enriched uranium, while Washington would waive sanctions on the country — immediately allowing Iran to sell its oil freely in a major concession from the U.S.

Pakistani Prime Minister Shehbaz Sharif, who helped mediate the deal to end the war, said it is taking “immediate effect” after leaders from both countries signed it, though a formal signing ceremony is still expected Friday.

According to officials from both countries, the agreement would open the Strait of Hormuz toll-free for two months and affirm a commitment to Lebanon’s territorial integrity in the face of Israel’s invasion against the Hezbollah militant group.

U.S. officials dictated the language to journalists Wednesday after days of secrecy, speaking on condition of anonymity. Iranian state TV later released text that largely reflects what the U.S. put out.

Though officials had said Trump and U.S. Vice-President JD Vance had digitally signed the agreement Sunday and that a ceremonial signing would be held Friday in Switzerland, a U.S. official who spoke on condition of anonymity to share details about the agreement said Trump signed the deal while at Versailles in France on Wednesday.

“It’s signed,” Trump said as he left Versailles, the historic palace where he dined with French President Emmanuel Macron after a trip to the Group of Seven summit in France.

A U.S. official said Iranian President Masoud Pezeshkian also signed it Wednesday, something Iran ‌state media also reported early ​on Thursday, ⁠citing ⁠Foreign Ministry ⁠spokesperson ​Esmaeil Baghaei.

It wasn’t immediately clear if that act started a 60-day negotiating clock to reach a final deal.

In a video posted online by a White House aide, Trump is seen seated at a table next to Macron signing a paper copy of the agreement. Trump then hands the document and pen to U.S. Secretary of State Marco Rubio as people in the room applaud.

Toll-free Strait of Hormuz not guaranteed

According to the officials, the draft agreement includes language that Iran agrees not to develop or procure nuclear weapons. It also addresses Tehran’s highly enriched Iranian uranium, requiring that it be downgraded on site as a minimum.

In return, the U.S. will move to waive, but not eliminate, some wide-ranging sanctions against Iran once the deal is signed. The U.S. draft of the agreement also secures toll-free passage of the Strait of Hormuz for only 60 days, and it does not preclude fees in future, the officials said.

It also has provisions to ensure the “territorial integrity” of Lebanon after Israel’s latest attacks against Hezbollah in Lebanese territory.

WATCH | How the deal is being framed in Iran:

Iranian authorities say deal with U.S. is a ‘victory’

U.S. and Iranian officials said on Sunday they have agreed on a peace framework for a deal to end their war, halt the U.S. blockade of Iran and reopen the Strait of Hormuz. In response, many Iranians are relieved, hoping it will bring a period of stability for the country and improve the economy. However, those opposed to the Iranian regime are disappointed that this war didn’t lead to regime change.

Israel has rejected the prospect of withdrawing from Lebanon, but the first point the agreement expressly states is that with the signing of the memorandum, military operations in Lebanon must stop.

Under the Obama-era nuclear agreement with Iran that Trump pulled out of in his first term, Iran also agreed to restrictions on its nuclear program and promised never to build an atomic weapon. The Islamic Republic maintains that its nuclear program is peaceful.

Meanwhile in Iran, Foreign Ministry spokesperson Baghaei was quoted by Iranian state television talking about the potential for the two presidents to sign the pact.

Pezeshkian became president on a promise of seeking better relations with the West. However, he’s been sidelined for months after Iran’s mass killing of protesters in January and in the war as hard-liners have taken over the levers of the country’s theocracy.

Deal could draw opposition in Washington

The U.S. and Israel went to war on Feb. 28 in part to prevent Iran from ever getting a nuclear weapon, although Trump’s goals in the conflict have repeatedly shifted. The interim deal stops the war before that aim is secured. Instead, it opens a two-month period for nuclear negotiations and appears to offer Iran several benefits up front while extracting little in return.

The U.S. agreement to immediately allow Iran to sell its oil freely and the offer to eventually lift all sanctions, for instance, represent major concessions that go beyond the terms of Iran’s 2015 nuclear deal with world powers. Trump withdrew the United States from that pact in his first term, declaring it the “worst deal ever.”

The accord likely will draw intense opposition in Washington, and it appears to be a major setback for Israeli Prime Minister Benjamin Netanyahu, who has come under criticism at home from the media, his opponents and even some allies as details emerge.

Much of the agreement would restore the status quo before the war, including ending hostilities and reopening the strait, which is a crucial passage for the world’s oil and natural gas and whose closure created a historic energy crisis.

Trump, in response to a reporter’s question at the G7 summit in France, said that the text of the agreement is not final and that if Iran doesn’t “behave” the U.S. will “go right back to dropping bombs right smack in the middle of their ​head.”

He also opened the door to abandoning it: “It’s a memorandum of understanding, and if I don’t like it, we’ll go back to shooting at them, dropping bombs.”

LISTEN | How Iran will emerge from war:

Front Burner29:48A changed Iran emerges from war

Netanyahu, facing an election this year, has maintained that Israel will continue to defend itself and to occupy vast swaths of Lebanon.

“I want Israel to protect themselves, but I do want them to use good judgment,” Trump said Wednesday from France.

Iranian attacks on shipping and the threat to vessels largely closed the Strait of Hormuz, drove up energy prices around the world and made many basics, including food, more expensive. The U.S. later provided military support to get some ships out, but traffic through the strait is nowhere near levels before the war.

WATCH | What about shipping and oil?:

Undoing the Strait of Hormuz energy crisis

CBC’s senior business correspondent Peter Armstrong breaks down why — even when the Strait of Hormuz is open again — getting markets back to pre-war levels is going to be a mammoth task.Concessions for Iran

The deal calls for the U.S. to lift its blockade imposed on Iranian ports and for the strait to return to its prewar traffic levels in 30 days, while acknowledging Iranian mines may still be in its waters that need to be destroyed.

While the deal says that the eventual lifting of sanctions on Iran will depend on future negotiations, the U.S. will immediately issue waivers on Iranian oil sales.

The interim deal also opens the door to ending all sanctions Iran faces from the U.S. and at the UN — including those over Tehran’s weapons programs and human rights abuses — though it says the schedule for that will be worked out later. Still, that far surpasses the 2015 deal, which only lifted some sanctions in exchange for Iran drastically reducing its enrichment and stockpile of uranium.

The accord would also provide Iran with at least $300 billion US to rebuild after an intense U.S. and Israeli bombing campaign. The money also appears dependent on the progress of further negotiations.

WATCH | Is Iran actually a nuclear threat?:

How close Iran was to making a nuclear bomb

U.S. President Donald Trump has justified war with Iran by saying the country was two weeks away from having a nuclear weapon. For The National, CBC’s Eli Glasner breaks down those claims and how close Iran really was to building a nuke.