LAUSANNE, Switzerland (AFP) — Marathon talks aimed at stopping Iran from acquiring nuclear weapons entered their final scheduled day Tuesday with global powers racing to agree a framework deal by a midnight deadline.

Officials say progress has been made on parts of what they hope will form the basis of a historic accord that has been threatening to escalate dangerously for 12 years, but that key differences remain.

An army of technical and sanctions experts worked until the small hours in Switzerland exchanging documents and trying to figure out how to put together what would be a highly complex agreement.

US Secretary of State John Kerry, in Lausanne since Wednesday in the latest in a series of meetings around the world with Iranian counterpart Mohammad Javad Zarif, late Tuesday said there “still remain some difficult issues.”

“We are working very hard to work those through. We are working late into the night and obviously into tomorrow (Tuesday),” Kerry told CNN in his luxury lakeside hotel.

A meeting between Kerry and his counterparts from the other five powers began shortly after 7:00 am (0500 GMT) and they were joined half an hour later by Zarif and other members of the Iranian nuclear team including nuclear chief Ali Akbar Salehi.

Absent was Russian Foreign Minister Sergei Lavrov who left on Monday. His spokeswoman said he would only return if there is a “realistic” chance of a deal. Russian Deputy Foreign Minister Sergei Ryabkov was however present.

Iranian Foreign Minister Javad Zarif, left, Head of Iranian Atomic Energy Organization Ali Akbar Salehi, second left, Special Assistant to Iranian president Hossein Fereydoun, second right, and Iranian Deputy Foreign Minister Abbas Araghchi wait for the start of a meeting with Britain, Russia, China, France, Germany, European Union and the U.S. officials at the Beau Rivage Palace Hotel in Lausanne, Switzerland Monday, March 30, 2015, during Iran nuclear talks (AP Photo/Brendan Smialowski, Pool)

Iranian Foreign Minister Javad Zarif, left, Head of Iranian Atomic Energy Organization Ali Akbar Salehi, second left, Special Assistant to Iranian president Hossein Fereydoun, second right, and Iranian Deputy Foreign Minister Abbas Araghchi wait for the start of a meeting with Britain, Russia, China, France, Germany, European Union and the U.S. officials at the Beau Rivage Palace Hotel in Lausanne, Switzerland Monday, March 30, 2015, during Iran nuclear talks (AP Photo/Brendan Smialowski, Pool)

The threat of new US sanctions, and domestic pressure on Iranian President Hassan Rouhani for his attempts at rapprochement with the West, would seem to rule out extending the talks yet again.

State Department acting spokeswoman Marie Harf appealed late Monday to the Iranians to help overcome the last hurdles. “It’s sort of time to see whether they can make these decisions.”

Under the deal, due to be finalized by June 30, the powers want Iran to scale back its nuclear program to give the world ample notice of any dash to make the bomb by extending the so-called “breakout” time.

In return, the Islamic republic, which denies wanting atomic weapons, is demanding the lifting of sanctions that have strangled its economy.

Some areas including the future size of Iran’s uranium enrichment capacity — a process for making nuclear fuel but also the core of an atomic bomb — appear tentatively sewn up.

But the two sides still appear wide apart on other areas including what to do with Iran’s stockpiles of nuclear material and the pace at which sanctions would be eased.

The powers are only prepared to suspend sanctions, not terminate them, in order to be able to put them back into place in case Iran violates the deal.

Other tricky issues include the duration of any accord, with Iran resisting demands by the powers to submit to ultra-tight inspections by the UN atomic watchdog for at least a decade.

The powers are also wary of Iran’s desire to continue researching and developing newer centrifuge machines that would enable Iran to process nuclear material more quickly.

With all eyes focused on Tuesday’s deadline, Harf said she could not predict what would happen if the outlines of a deal were not agreed in time.

“Obviously we always are planning for contingencies,” she told reporters, adding: “We will have to take a very hard look at where we are and we will have to decide what happens next.”

“No one is thinking about what will happen if there is no deal. No-one has discussed this in the talks. Everyone is focused on finding solutions,” an Iranian negotiator said.