The U.S. and Iran on Thursday were closing in on an agreement to restore the 2015 nuclear deal, although officials from both countries warned final issues still needed to be nailed down in the coming hours.

After weeks of intense negotiations in Vienna involving the U.S. and Iran, and Britain, France, Germany, Russia and China, senior diplomats said they were now within reach of an agreement that would restore the 2015 deal. That pact lifted most international sanctions on Tehran in exchange for strict but temporary restrictions on Iran’s nuclear work.

“We are very close to an agreement,” chief British negotiator Stephanie Al-Qaq said on Twitter late Thursday. “Now we have to take a few final steps.”

U.S. and Iranian officials cautioned there was at least one big issue that still needed solving: Iran has been pushing for more sanctions relief if the nuclear deal is restored. In particular, it wants the Islamic Revolutionary Guard Corps to be taken off Washington’s most significant terror sanctions list, the Foreign Terrorist Organization.

However, it is almost certain under any restored nuclear deal that the Biden administration will lift sanctions on dozens of terrorist-listed people and entities, a move that is already sparking criticism in Washington.

While Iran says it isn’t trying to build nuclear weapons, a look at its key facilities suggests it could develop the technology to make them. WSJ breaks down Tehran’s capabilities as it hits new milestones in uranium enrichment and limits access to inspectors. Photo illustration: George Downs (Video from 3/5/21)

Iranian officials also cautioned that talks hadn’t crossed the finish line.

“Nobody can say the deal is done until all the outstanding remaining issues are resolved,” said Saeed Khatibzadeh, Iran’s Foreign Ministry spokesman said on Twitter. “Extra efforts needed.”

The U.S. left the nuclear deal in 2018, with former President Donald Trump saying it did too little to stop Iran’s pathway to a nuclear weapons. Since 2019, Iran has expanded its nuclear work. On Thursday, the U.N.’s International Atomic Energy Agency said Iran had doubled its stockpile of highly enriched uranium, leaving the country close to amassing enough weapons-grade nuclear fuel for a bomb.

The Vienna talks have focused on agreeing on the steps Tehran and Washington would need to take to restore the pact.

European and U.S. diplomats have said a deal needs to be wrapped up in the next few days or they will exit the negotiations. Time is running short, they say, because Iran’s nuclear advances mean it could soon be impossible to recapture the main benefit of the deal for the West, Russia and China—keeping Iran far enough away from having enough nuclear material for the bomb.

Under a restored deal, Iran’s “breakout time”—the duration needed to amass enough nuclear fuel or a bomb—could be as little as six months, U.S. officials say, compared with around 12 months when the original deal came into force in January 2016.

A first sign that negotiations were advancing came Thursday morning when the IAEA said its Director General Rafael Grossi would travel to Tehran for talks to resolve one of the final issues standing in the way of a deal.