The agreement, a focal point of U.S. President Barack Obama’s foreign policy, appears set to reshape relations between Iran and the West, with its effects likely to ripple across the volatile Middle East.

Representatives of Iran, the United States and the other nations involved in the marathon talks were holding a final meeting in Vienna on Tuesday.

Speaking ahead of the session, Iranian Foreign Minister Mohammad Javad Zarif called the deal a “historic moment,” although he cautioned that it was “not perfect.”

“It’s a good day for diplomacy, it’s a good day for compromise, it’s a good day for a new beginning between Iran — a pivotal state in the Middle East — and the United States,” said Fawaz Gerges, professor of Middle East studies at The London School of Economics.

Leaders of the Western nations involved in the talks have backed a deal as the best way to stop Iran from becoming a nuclear power.

Iran, meanwhile, has been eager to get rid of international economic sanctions that have been squeezing its economy.

The essential idea behind the deal is that in exchange for limits on its nuclear activities, Iran would get relief from sanctions while being allowed to continue its atomic program for peaceful purposes.

After news of the deal emerged, Yukiya Amano, the chief of the International Atomic Energy Agency, said he had signed a “roadmap” with the Iranian government “for the clarification of past and present outstanding issues regarding Iran’s nuclear program.”

Far from over

But the deal between Iran and world powers, brokered during lengthy negotiations in a Vienna hotel, is far from the end of the story.

Details on what terms were agreed on key technical issues weren’t immediately available Tuesday.

The accord is expected to face fierce opposition from Republicans in the U.S. Congress, as well as from Israeli Prime Minister Benjamin Netanyahu, a longstanding critic of the negotiations.

“From the initial reports we can already conclude that this agreement is a historic mistake for the world,” Netanyahu said Tuesday. “Far-reaching concessions have been made in all areas that were supposed to prevent Iran from obtaining nuclear weapons capability.”

Congress has 60 days to review the agreement, giving its opponents plenty of time to dig into the details and challenge the Obama administration’s position.

In Tehran, the deal will need the clear backing of Iran’s supreme leader, Ayatollah Ali Khamenei, to fend off any objections from hardliners suspicious of an accord with the United States after decades of hostility and mistrust.

Iranian President Hassan Rouhani said on Twitter that the deal shows that “constructive engagement works.”

“With this unnecessary crisis resolved, new horizons emerge with a focus on shared challenges,” he tweeted.

Two years of negotiations

It’s an agreement roughly two years in the making.

Diplomats from the United States, the UK, France, China, Russia and Germany have been negotiating with the Iranians since 2013.

The official talks began after the election in Iran that year of Rouhani, widely seen as a reformer. He seemed open to warmer ties with the West and said he would work to end international sanctions.

Discussions in November 2013 led to an interim deal called the Joint Plan of Action that offered some sanctions relief in exchange for curbs on Iran’s nuclear program, pending further talks toward a permanent solution.

Three months ago, negotiators made a further breakthrough, settling on a framework deal that established the broad principles for the final agreement.

The talks in recent weeks to reach a comprehensive deal had stretched way past their original deadline of June 30. As recently as late Monday, sticking points remained, including Iran’s insistence on the lifting of an embargo on the sale of conventional weapons and missiles, multiple sources said.