DUBAI, United Arab Emirates (AP) — The United States and Iran reached an initial agreement Monday that would extend their shaky ceasefire and lead to the reopening of the Strait of Hormuz, but significant challenges remain, including whether Israel will continue its offensive in Lebanon.

Details of the agreement were not immediately released, but it appeared that it would not be implemented until it is signed, which mediator Pakistan said would happen Friday in Geneva. Until then, shipping will likely remain restricted in the strait, which is a crucial passage for the world’s oil and gas and the closure of which has sparked a global energy crisis.

Israel’s defense minister said Monday that the country wouldn’t withdraw from land seized in Lebanon, where Israel is fighting the Iranian-backed Hezbollah militant group. Israel joined the U.S. in launching the war on Feb. 28, but it is not party to the deal. A spokesman in Prime Minister Benjamin Netanyahu's office said Israel will continue to defend itself against any threat to its security.

That alone could scupper the deal, since Iran has insisted any agreement to end the war include an end to the fighting in Lebanon.

But the agreement also faces other major challenges. It gives just 60 days to decide what to do about Iran’s stockpile of highly enriched uranium and its nuclear program — which the U.S. and Israel worry could be used to build an atomic weapon, despite Tehran’s insistence that it is peaceful. It took years for Iran and world powers to negotiate a 2015 agreement to rein in Tehran’s nuclear program.

President Donald Trump unilaterally withdrew the U.S. from that accord in his first term, setting the stage for the tensions that culminated in the current war.

Despite the uncertainties, world leaders from Europe to China welcomed the deal to end a conflict that has killed thousands across the Middle East, including the top leaders of Iran’s theocracy, and raised the prices of fuel, food and other basic goods far beyond the region.

Still, some expressed concern that the deal would actually come about: Luxembourg’s foreign minister, Xavier Bettel, noted: “It’s a long time till Friday.”

Trump, who faced pressure to end the war ahead of congressional midterm elections in November, hailed the agreement on social media, saying that he had authorized the Strait of Hormuz to open and the U.S. blockade of Iranian ports to end. He later said the strait wouldn’t open until Friday.

Iran’s deputy foreign minister, Kazem Gharibabadi, confirmed the agreement on state television but said Iran would not start implementing it until it was signed.

Early in the war, Iranian attacks on ships brought traffic in the crucial waterway to a near standstill. Trump implemented a blockade in response.

The closure of the strait — through which a fifth of the world’s oil and natural gas passed before the war — and the blockade sent fuel prices skyrocketing, and the knock-on effects rippled throughout the world economy. It will likely take months before energy companies can resume operations to the point of meeting the world’s demand, according to energy experts.

Iranian and U.S. officials will hold preparatory meetings in Doha, Qatar, this week before the signing, said a diplomat with direct knowledge of the talks, who spoke on condition of anonymity to discuss the closed-door meetings.

The success of the deal rests at least partially on what happens between Israel and Hezbollah in Lebanon. Israel’s bombing of Beirut’s southern suburbs on Sunday nearly derailed the negotiations, and a previous attack led Iran to fire on Israel and Israel to fire back.

Defense Minister Israel Katz, meanwhile, said Israel plans to stay “indefinitely” in land it holds in Lebanon, Syria and the Gaza Strip.

Katz also threatened that if Iran attacks Israel over its strikes in Lebanon, Israel will strike Iran with “great force.” Over the past 2 1/2 years, Israel has taken control of areas in Gaza, Lebanon and Syria amounting to 1,000 square kilometers (386 square miles) of territory.

In response to questions about where Israel stands on the deal, David Mencer, a spokesman in Netanyahu’s office, told The Associated Press that Israel and the U.S. remain fully aligned on preventing Iran from obtaining nuclear weapons. But he added that Israel will not tolerate attacks from Hezbollah on its territory and will continue to act against those who seek to harm its citizens.

Hezbollah has not yet commented on the deal.

___

Becatoros reported from Athens, Greece. Associated Press writers Munir Ahmed in Islamabad, Will Weissert in Washington, Julia Frankel in Jerusalem, Abby Sewell in Beirut, Najib Jobain in Doha, Qatar, and Melanie Lidman in Tel Aviv, Israel, contributed to this report.