A tripartite deal between the US, Israel and the Palestinians which would see Israeli spy Jonathan Pollard freed in exchange for a partial settlement construction freeze and the release of hundreds of Palestinian prisoners was nearing completion on Tuesday afternoon, officials said.

Under the proposed deal peace, talks between Israel and the Palestinians would be extended into 2015 and Pollard would be released in the next two weeks, a source close to the talks said.

Israel would also commit to put an unofficial moratorium on settlement building for the next eight months under the agreement, though it would not extend to East Jerusalem.

“Israel did not accept the Palestinian demand for total and complete settlement freeze but agreed to adopt a policy of restraint concerning government tenders” in the West Bank, the source told The Times of Israel.

Under the terms, Israel will soon release the last 27 prisoners from the 104 agreed to when peace talks began in July.

In addition, another 400 low-level prisoners, not convicted of violent crimes, would be set free. This group would include women, children and inmates with only a few months of incarceration left, the source said.

The identity of the prisoners would be decided partly by Israel and partly by the Palestinian Authority.

According to Israel Radio, the agreement was waiting for approval from Ramallah.

Prime Minister Benjamin Netanyahu met with senior Likud party members on Tuesday to elaborate on the details of the plan and enlist their support. According to Maariv, the right-wing Jewish Home party would not torpedo the agreement despite its opposition to additional prisoner releases.

Earlier in the day US Secretary of State John Kerry held a second round of talks with Netanyahu amid a push to salvage faltering peace efforts.

The breakfast meeting came after Kerry made a surprise trip to Israel to keep the talks on track amid a bitter tussle over the expected release of Palestinian prisoners.

Although Kerry was scheduled to leave for a NATO meeting in Brussels on Tuesday morning, a senior Palestinian source said he would return to the region within 24 hours for talks with Palestinian Authority President Mahmoud Abbas.

“Kerry will fly to Europe today for previous engagements and will come back to meet the president tomorrow at noon,” the Palestinian source told AFP. State Department spokeswoman Jen Psaki confirmed that Kerry would be returning to the region. “Secretary Kerry will visit Ramallah on Wednesday,” she told reporters traveling with him.

Talks with Abbas were canceled Monday when a meeting with Netanyahu dragged on too late. Kerry met instead with the chief Palestinian negotiator Saeb Erekat and Palestinian intelligence chief Majid Faraj.

The two presented Kerry with Ramallah’s demands in exchange for agreeing to extend talks until the end of the year, including the release of nearly a thousand Palestinian prisoners, according to reports in Arab media.

On Monday, sources said the release of US-born Israeli spy Jonathan Pollard was a way to unblock the talks impasse and coax Israel into agreeing to the releases and the settlement freeze.

Pollard was arrested in Washington in 1985 and condemned to life imprisonment for spying on the United States on behalf of Israel. One proposal could see Pollard freed before the week-long Jewish holiday of Passover, which begins in mid-April.

In exchange, Israel would release the final batch of prisoners as well as another group of detainees, and the sides would agree to extend the talks.

State Department spokeswoman Jen Psaki, however, refused to be drawn, saying: “Jonathan Pollard was convicted of espionage and is serving his sentence. I do not have any update for you on his status.”

A number of Israeli officials have said the release of the prisoners would be too high a price to pay for Pollard’s freedom.

Deputy Defense Minister Danny Danon told Israel Radio Tuesday he would quit the government if Israel went ahead with the deal, even with Pollard thrown in.

The Palestinians on Monday gave Kerry a 24-hour deadline to come up with a solution to the row over the release of the Palestinian prisoners, or threatened to go to UN bodies later in the day to press their claims for statehood.

Erekat said the PA would not discuss extending talks until the fourth group of inmates — including several Israeli citizens — was released, according to Haaretz.

Jerusalem had not given any indication if it is still considering the release, which could bring down Netanyahu’s government.

US officials insist things are moving, saying only that there were a lot of complex pieces to put in place.

It appears that Kerry is shifting his focus away from reaching a framework deal toward simply keeping the two sides talking after an April 29 deadline expires.

Avi Issacharoff and Raphael Ahren contributed to this report.