The UN Security Council on Friday demanded that Israel halt settlements in Palestinian territory, after the United States refrained from vetoing a resolution condemning its closest Middle East ally.

In a rare and momentous step, the United States instead abstained, enabling the adoption of the first UN resolution since 1979 to condemn Israel over its settlement policy.

Applause broke out in the chamber after the text was passed with support from all remaining members of the 15-member council.

The landmark move by the Security Council came despite an effort led by Israel and backed by US President-elect Donald Trump to block the text.

Israeli Prime Minister Benjamin Netanyahu immediately rejected the UN resolution and slammed the outgoing administration of President Barack Obama for refusing to veto it.

"Israel rejects this shameful anti-Israel resolution at the UN and will not abide by its terms," a statement from Netanyahu's office said.

"The Obama administration not only failed to protect Israel against this gang-up at the UN, it colluded with it behind the scenes," it said.

"Israel looks forward to working with President-elect Trump and with all our friends in Congress, Republicans and Democrats alike, to negate the harmful effects of this absurd resolution."

Trump reacted after the vote by promising change at the world body after he takes office next month.

"As to the U.N., things will be different after Jan. 20th," he tweeted.

- Saving two-state solution -

Ambassador Samantha Power said the US abstention stemmed from concerns that the expansion of the Jewish outposts was threatening the two-state solution aimed at achieving peace by creating a Palestinian state alongside Israel.

"We cannot stand in the way of this resolution as we seek to preserve a chance of attaining our longstanding objective of two states living side by side in peace and security," she said.

"The settlement problem has gotten so much worse that it is now putting at risk the very viability of that two-state solution."

UN Secretary-General Ban Ki-moon welcomed the passage of the resolution as "a significant step, demonstrating the Council's much needed leadership and the international community's collective efforts to reconfirm that the vision of two States is still achievable."

Palestinian president Mahmud Abbas's office said the vote was "a big blow" to Israeli policy and a show of "strong support for the two-state solution."

Israeli settlements are seen as a major stumbling block to peace efforts, as they are built on land the Palestinians consider part of their future state.

The United Nations maintains that settlements are illegal, but UN officials have reported a surge in construction over the past months.

Some 430,000 Israeli settlers currently live in the West Bank and a further 200,000 Israelis live in east Jerusalem, which Palestinians see as the capital of their future state.

The resolution demands that "Israel immediately and completely cease all settlement activities in the occupied Palestinian territory, including East Jerusalem."

It states that Israeli settlements have "no legal validity" and are "dangerously imperiling the viability of the two-state solution."

- A 'no' vote for negotiation -

Israeli Ambassador Danny Danon bluntly told the council that the resolution would not have the hoped-for impact of spurring peace efforts.

"By voting 'yes' in favor of this resolution, you have in fact voted 'no'. You voted 'no' to negotiation, you voted 'no' to progress and a chance for better lives for Israelis and Palestinians, and you voted 'no' to the possibility of peace," Danon told the council.

Palestinian ambassador Riyad Mansour said the resolution "may be too little, too late."

Friday's vote was scheduled at the request of four countries -- New Zealand, Malaysia, Senegal and Venezuela -- who stepped in to push for action a day after Egypt put the draft resolution on hold.

After the resolution passed, Israel announced its ambassadors to Senegal and New Zealand had been ordered to return for consultations. It has no diplomatic relations with Venezuela or Malaysia.

Egyptian President Abdel Fattah al-Sisi backtracked on the move to condemn Israel's settlement policy after receiving a phone call from President-elect Trump, who spoke out in favor of a US veto.

The United States vetoed a similar resolution in 2011, which was the sole veto cast by the Obama administration at the Security Council.

Washington has used its veto a total of 30 times to block council resolutions concerning Israel and the Palestinians, according to Security Council Report, a research organization.

It last abstained in 2009 on a resolution calling for a ceasefire in Gaza.

The Middle East peace process has been comatose since a US initiative to re-launch peace talks collapsed in April 2014.

France has announced plans to host an international conference on January 15 to try to restart talks based on the two-state solution.

Trump campaigned on a promise to recognize Jerusalem as Israel's capital and chose as ambassador to Israel the hardliner David Friedman, who has said Washington will not seek to curtail settlement building in the occupied West Bank.