The U.N. Security Council on Friday passed a resolution demanding that Israel cease Jewish settlement activity on Palestinian territory in a unanimous vote that passed when the United States abstained rather than using its veto as it has reliably done in the past.

The resolution declares settlements constructed on land Israel has occupied since the 1967 war, including in East Jerusalem, to have “no legal validity.” It said settlements threaten the viability of the two-state solution, and it urged Israelis and Palestinians to return to negotiations that will lead to two independent nations.

The United States’ abstention Friday was a rare rebuke to Israel, and it reflected mounting frustration in the Obama administration over settlement growth that the United States considers an obstacle to peace. With President Obama’s time in office due to end in barely a month, his decision not to veto was a last-minute symbolic statement of that displeasure and a sense of exasperation that the time has come for two states to be carved out of the contested land.

The administration’s move also defied Donald Trump’s call on Thursday for the United States to veto the resolution. The incoming Trump administration has signaled that there will be a shift in U.S. policy toward Israel, a point the president-elect hammered home about an hour after Friday’s vote when he tweeted, “As to the U.N., things will be different after Jan. 20th.”

Trump has supported moving the U.S. Embassy from Tel Aviv to Jerusalem. He has appointed David Friedman, a bankruptcy lawyer who believes Israelis should annex and settle the West Bank, as the next U.S. ambassador to Israel.

It is unclear what, if any, impact this resolution will have. Resolutions reflect the opinion and will of the 15 members of the Security Council, but legal scholars differ about how binding they are. And Israeli Prime Minister Benjamin Netanyahu has insisted that Israel will not abide by the terms of the settlements resolution.

About 400,000 Jews live in roughly 150 settlements in the West Bank on land that the Palestinians want for a future state east of the line formed after the 1967 war. An additional 200,000 Israelis live in East Jerusalem, which Palestinians want to become the capital of their future state. Many Israelis consider the settlements to be in the ancestral homeland of the Jews and refer to them by their biblical names, Judea and Samaria. Most nations consider the settlements illegal. U.S. diplomats characterize them as illegitimate and say they exacerbate tensions between Israelis and the Palestinians who live nearby, thereby undercutting efforts to advance peace.

Twice, the Obama administration has made concerted attempts to broker peace negotiations between the Israelis and Palestinians. The most recent, involving nine months of intense diplomacy by Secretary of State John F. Kerry, collapsed in 2014, and nothing has been able to revive the talks.

Throughout the year, the administration has been increasingly vocal in its exasperation. The State Department has issued several sharp criticisms of settlement construction, in July calling it “provocative and counterproductive.” Since then, more than 2,600 housing units have been built in settlements.

Still, the United States agreed this year to provide Israel with $38 billion in military aid over 10 years, the largest such package ever. U.S. and Israeli officials both have said security and military cooperation between the two countries has remained excellent, even when Obama and Netanyahu have clashed.

The international community has shown increasing impatience with the intractability of the ­Israeli-Palestinian conflict. Proposals have been put forth in the last year by Egypt, France, and a group made up of the European Union, the United Nations, Russia and the United States. Israel has blamed the impasse on Palestinian refusal to recognize the legitimacy of Israel as a Jewish state. Palestinians blame Israel for occupying lands they consider rightfully theirs.

The 14-to-0 vote, with only the United States abstaining, followed an intense campaign from Israel to derail it. It was to have been voted on Thursday, but Egypt withdrew its sponsorship after the country’s president spoke by phone with Trump, who got involved at Israel’s request. Friday’s resolution was sponsored by New Zealand, Malaysia, Venezuela and Senegal.

The resolution’s passage brought a swift reaction, particularly in Israel and in Congress.

Netanyahu said Friday that he welcomed Trump replacing Obama, whose administration, he said, had “colluded” in a diplomatic assault on Israel.

“Israel rejects this shameful ­anti-Israel resolution at the UN and will not abide by its terms,” Netanyahu said in a statement released by his office. “The Obama administration not only failed to protect Israel against this gang-up at the UN, it colluded with it behind the scenes.”

“This is absolutely shameful,” House Speaker Paul D. Ryan (R-Wis.) said in a statement, promising that next year “our unified Republican government will work to reverse the damage done by this administration, and rebuild our alliance with Israel.”

But Palestinian diplomats called the resolution a chance to salvage the possibility of two states and exulted in seeing the U.N. pass a resolution reflecting their views.

“After years of allowing the law to be trampled and the situation to spiral downward, today’s resolution may rightly be seen as a last attempt to preserve the two-state solution and revive the path for peace,” Riyad Mansour, the Palestinian ambassador to the United Nations, said Friday.

Kerry said he would speak more in the coming days about the U.N. vote and “the way ahead” for Israel and the Palestinians.

“That future is now in jeopardy, with terrorism, violence and incitement continuing and unprecedented steps to expand settlements being advanced by avowed opponents of the two-state solution,” Kerry said. “That is why we cannot in good conscience stand in the way of a resolution at the United Nations that makes clear that both sides must act now to preserve the possibility of peace.”

Friday’s resolution also condemned Palestinian incitement to violence and all acts of terrorism. Samantha Power, the U.S. ambassador to the United Nations, said the United States would not have allowed its passage without that proviso. She also criticized the United Nations itself, saying it had perpetuated a double standard by repeatedly condemning Israeli actions while remaining silent about Palestinian incitement.

In the hours before the vote, Israeli media reported harsh criticism toward Obama and Kerry coming from an unnamed official in Netanyahu’s office. The office accused them of having “abandoned” Israel by refusing the block the resolution with a veto.

White House deputy national security adviser Ben Rhodes said Friday that the administration's pursuit of a two-state solution is “guided by our belief that it is the only way to preserve Israel’s security in the long run.”

“President Obama has done more for Israel and its security than any previous U.S. president,” Rhodes told reporters.

That argument did not assuage Israeli anger at the U.S. decision not to veto the resolution, a decision the Obama administration still had not shared with the Israeli government a few hours before the vote. According to an Israeli official who spoke on the condition on anonymity because the conversations were private, a White House official told an Israeli official Thursday that the United States is Israel’s best friend. The Israeli replied, “Friends don’t take friends to the Security Council.”

Eglash reported from Jerusalem. Karoun Demirjian and David Nakamura contributed to this report.