A controversial new United Nations Security Council resolution condemning Israeli settlements in Palestinian territory has triggered a brutal and messy diplomatic fight between President Obama, Israeli Prime Minister Benjamin Netanyahu, and now President-elect Donald Trump.

The war of words got even nastier Wednesday, when Secretary of State John Kerry delivered a high-profile speech warning that Netanyahu’s settlement policy could doom any chance at a peace deal and threaten Israel’s future as a Jewish and democratic state.

“The status quo is leading toward one state and perpetual occupation,” Kerry warned. “The Israeli prime minister publicly supports a two-state solution, but his current coalition is the most right-wing in Israeli history, with an agenda driven by its most extreme element.”

Netanyahu immediately shot back that Kerry’s speech was “biased against Israel” and "obsessively focused" on settlements, and “barely touched upon the root of the conflict — Palestinian opposition to a Jewish state in any boundaries."

So who’s right? And why are both countries so angry? It’s a complex answer that involves geopolitical maneuvering, international legal issues, and a healthy dose of seemingly nonsensical diplomatic language, so you’d be forgiven for feeling a little bit lost trying to sort out exactly what’s going on.

If so, don’t worry: We’ve got you covered. What follows is a simple guide to the whole kerfuffle.

1) What did the Obama administration do at the UN?

The United States on Friday abstained on a vote over a UN Security Council resolution demanding an end to Israeli settlements in Palestinian territory. By abstaining — instead of vetoing the resolution, as the United States has reliably done to similar measures for decades — the Obama administration allowed the highly symbolic measure to make it through the chamber by a unanimous 14-0 margin.

It was the first time in nearly 40 years that the Security Council has passed a resolution critical of Israeli settlements. It was also a firm rebuke of both Netanyahu, who had strongly argued against the resolution, and Trump, who had taken the highly unprecedented move of weighing in on Thursday, before the vote, and pressing for the measure to be vetoed.

The Jewish communities in question are in the West Bank and East Jerusalem, both of which were captured by Israel during 1967’s Six-Day War. They range in size from small outposts of just a few dozen people to Ariel, home to some 20,000 people and a thriving university. Two of the more controversial settlements lie inside and adjacent to Hebron, a large Palestinian city that houses the burial place of Abraham, making it one of the holiest sites in both Judaism and Islam. Dozens of Jews and Muslims have been killed in political violence there in recent decades.

Israel’s construction of new neighborhoods throughout East Jerusalem is technically as illegal as its settlement building elsewhere in the West Bank, but many American policymakers from both parties have long acknowledged that Jewish neighborhoods in that part of the city would remain under Israeli control in any peace agreement. That’s particularly true of the Jewish Quarter of the Old City, home to the Western Wall, the most religiously important place in Judaism.

It’s important to note that the settlement population is enormous and rapidly growing; nearly 600,000 Jews live in East Jerusalem and the West Bank, a figure that has grown by 100,000 just since Obama took office in 2009.

Citing those statistics, administration officials say they had to act now because the population is so big that it would soon be basically impossible for Israel to withdraw from any meaningfully large parts of the West Bank — helping to doom the already faint chances of a peace deal.

2) What did the resolution actually say?

UN resolution 2334 is a long document full of diplomatic jargon (you can read the full text here), so we’ll just skip to the important parts.

The resolution demands that Israel “immediately and completely cease all settlement activities in the occupied Palestinian territory, including East Jerusalem,” and declares that the establishment of settlements by Israel has “no legal validity and constitutes a flagrant violation under international law.”

This is far stronger language than the United States has ever officially used to describe Israeli settlement activity before. Although the standard US position has for three decades been that such settlements, which are built on land intended to be part of a future Palestinian state, are “obstacles to peace,” the United States has always stopped short of describing them as “illegal” under international law.

The resolution condemns "all measures aimed at altering the demographic composition, character and status of the Palestinian Territory occupied since 1967, including East Jerusalem." It lists among those measures "the construction and expansion of settlements, transfer of Israeli settlers, confiscation of land, demolition of homes and displacement of Palestinian civilians, in violation of international humanitarian law and relevant resolutions."

The text also calls on all member states “to distinguish, in their relevant dealings, between the territory of the State of Israel and the territories occupied since 1967” — language that, as the Times of Israel’s Eric Cortellessa explains, “Israel fears will lead to a surge in boycott and sanctions efforts.”

Finally, the measure includes a request that the UN secretary general report to the Security Council every three months on the resolution's implementation — all but guaranteeing that there will continue to be regular engagement on the issue.

3) What practical effect (if any) does the resolution have?

The resolution’s effects are primarily diplomatic and political, though there are some potential legal implications in the longer term.

To begin with, it’s a non-binding resolution. That means it’s basically just a strongly worded statement that doesn’t impose any sort of sanctions or other punishments on Israel for its past settlement activity, nor does it put in place such measures to punish Israel for any future settlement activity. Those would have to be included in a separate Security Council resolution, and it’s virtually certain that both Obama and Trump would veto such a measure.

The whole point of the resolution is to further solidify the longstanding international consensus that Israel’s settlement activity is illegal and a roadblock to achieving a peaceful solution to the decades-long Israel-Palestine conflict — in other words, to isolate Israel and show it that the whole world thinks what it is doing is wrong. The hope is that this will make Israel change its policies in order to get back into the good graces of the international community.

But Israel is free to completely ignore the resolution and tell the international community to stuff it. And indeed, Israel’s government initially looked like it would do just that, announcing Monday that it planned to move ahead with the construction of nearly 6,000 new homes in the predominantly Palestinian eastern Jerusalem, with 600 settlements due to be approved Wednesday.

“We remain unfazed by the UN vote, or by any other entity that tries to dictate what we do in Jerusalem,” the city’s deputy mayor, Meir Turgeman, told the newspaper Israel Hayom. However, on Wednesday, Netanyahu reportedly instructed the Jerusalem municipality to wait on approving new housing units in an attempt to avoid further inflaming US-Israeli relations.

Still, the resolution could potentially have some longer-term legal and economic implications for Israel. For instance, Tel Aviv University law professor Aeyal Gross writes at Haaretz that the resolution could encourage the International Criminal Court to be more aggressive in its examination of settlement construction.

ICC prosecutor Fatou Bensouda is currently working on a report on the Israeli-Palestinian conflict, but it is not a full-scale investigation, and no criminal case has been brought against Israel. Gross explains that this could potentially change due to the new UN resolution.

“The consensus that the resolution represents on the illegality of the settlements and the description of their construction as a ‘flagrant’ violation of international law may convince Bensouda that she has strong grounds to pursue the matter before the ICC,” writes Gross.

And indeed, Palestinian leaders are already saying that they’ll use the resolution to seek International Criminal Court indictments of Israeli leaders, push for a formal probe into whether Israel is violating the Geneva Conventions, and get foreign governments to ban the import of any products made in Israeli settlements.

4) Why is this resolution happening now?

The push to bring this resolution before the Security Council in the last few remaining days of Obama’s term as president seems to have been a calculated move by Palestinian diplomats.

The Wall Street Journal reports, “As early as October, Palestinian diplomats at the UN began assessing prospects for a Security Council resolution. They drafted two resolutions: one that would condemn Israel’s rapid expansion of settlements in disputed territories of West Bank and East Jerusalem, and another that would recognize Palestine as a state at the UN.”

Arab diplomats told the Journal that the Palestinians ultimately decided to drop the statehood resolution because they believed it would inevitably be vetoed by the Obama administration.

The Palestinians appear to have seen a path forward all the same, believing that Obama’s long-held opposition to the Israeli settlements — and deep animosity toward Netanyahu — meant the US president might allow a slightly watered-down resolution to make it through the Security Council.

James Zogby, president of the Arab American Institute and an influential pro-Palestinian activist, told Al Jazeera, "Knowing that the Obama administration was not going to restart the peace process, we told them that the least they could do is resurface the issue surrounding the illegality of settlements, something which hasn't been said since the Carter administration."

It was decided that Egypt, as the only Arab member of the Security Council, should be the one to sponsor the resolution. And indeed, Egypt was the measure’s initial sponsor. However, on Thursday, just one day before the vote was scheduled to take place, Egypt suddenly announced that it was delaying the vote indefinitely.

This was apparently in response to an unprecedented intervention by Trump, in the form of a personal phone call to Egyptian President Abdel Fattah el-Sisi urging him to table the vote. Netanyahu, who has developed a close relationship with Sisi, also pressed the Egyptian leader to withdraw the measure.

The resolution was then reintroduced on Friday by four of the other non-permanent members of the Security Council — New Zealand, Malaysia, Venezuela, and Senegal — but not Egypt. That resolution is the one that the US abstained on, and which ultimately passed.

5) Why didn’t the US veto the resolution?

US Ambassador to the UN Samantha Power said in a statement after the vote that “it is because this resolution reflects the facts on the ground — and is consistent with U.S. policy across Republican and Democratic administrations throughout the history of the State of Israel — that the United States did not veto it.”

Ben Rhodes, Obama’s deputy national security adviser for strategic communications, explained further to PBS Newshour:

We’ve had failed peace processes after failed peace process, and the pace of settlement construction has accelerated significantly. And just recently, you had the Israeli prime minister saying that this is the most pro-settlement in administration in Israeli history, the Israeli government that is currently in place. We believe that at this pace, a two-state solution could be put at risk. We believe that would be profoundly bad for Israel and its security. And so, that’s why the president took the position that he did.

But beyond the White House’s formal statements on the matter, the move was widely seen as Obama’s parting shot at Netanyahu, with whom the president repeatedly clashed throughout his tenure.

As my colleague Zeeshan Aleem writes, although the Obama administration gave Israel a bigger military aid package than any US president in history, and has vetoed past UN condemnations of settlements, Obama had a “tense and at times outright hostile relationship with the right-wing Netanyahu.” Among other things, they clashed over Israeli settlement expansion and the terms of the controversial Iran nuclear deal.

But Obama’s parting shot was also aimed at Trump, who has indicated he wants to take a much stronger pro-Israel stance. For instance, he has said he wants to move the US embassy to Jerusalem — a step that, as my colleague Zack Beauchamp explains, “every US government has refrained from doing because the future of the disputed city is meant to be resolved as part of direct talks between the two sides for a final status peace deal.”

And Trump’s newly named ambassador to Israel, David Friedman — who has been a personal friend of Trump’s for about 15 years — is staunchly pro-settlement and has said he opposes the two-state solution that has been a cornerstone of US policy about ending the conflict for decades.

It’s possible that Trump’s stunning intervention — directly meddling in a major US foreign policy decision before he has even taken office — may have played a role in ultimately pushing Obama to take the dramatic step of abstaining on Friday’s vote.

But even if so, it’s almost certainly not the main reason. As Kerry stated in his speech defending the decision to abstain on the vote, “We did not take this decision lightly.” The resolution is directly in line with Obama’s own view on Israeli settlements, and the vote was essentially Obama’s way of making a symbolic last stand on an issue that has long concerned him but that he proved wholly unable to do much of anything about during his time in the White House.

6) How did the Israeli government react to the vote?

Not particularly well. In fact, they’re royally pissed.

Speaking in a televised address at a Hanukkah candle-lighting ceremony on Saturday, Netanyahu angrily denounced the Obama administration for having carried out what Netanyahu termed a “disgraceful anti-Israel maneuver.”

“The Obama administration not only failed to protect Israel against this gang-up at the UN, it colluded with it behind the scenes,” Netanyahu’s office said in a statement. The statement also said that Israel "looks forward" to working with the incoming Trump administration to "negate" the resolution's "harmful effects."

Then over the weekend, Israeli officials went even further. David Keyes, a spokesperson for Netanyahu, told Fox News on Sunday that Jerusalem had gathered “iron-clad information from sources in both the Arab world and internationally that this was a deliberate push by the United States and in fact they helped create the resolution in the first place.”

Israeli Ambassador Ron Dermer later told CNN that they would present this evidence of Obama’s plot against Israel to the incoming Trump administration. “If they want to share it with the American people, they are welcome to do it,” Dermer said.

Netanyahu immediately summoned US Ambassador Daniel Shapiro as well as ambassadors from 10 of the 14 countries that voted in favor of the resolution and have embassies in Israel — Britain, China, Russia, France, Egypt, Japan, Uruguay, Spain, Ukraine, and New Zealand — to protest the resolution. The prime minister also instructed the Foreign Ministry to suspend any Israeli diplomatic trips to countries that supported the resolution and reduce contact with their embassies.

The Israeli government also lashed out at the UN, announcing a series of retaliatory moves aimed at correcting what it sees as unfair anti-Israel bias within the institution and declaring it would halt 30 million shekels — about $7.8 million — in funding to five United Nations institutions that are “particularly hostile to Israel,” such as the United Nations Relief and Works Agency for Palestine Refugees in the Near East (UNRWA).

Finally, Netanyahu warned nations against taking any further actions on this issue, declaring that “Israel is a country with national pride, and we don't turn the other cheek.”

The Israeli leader capped off his attacks at the Obama administration with his blistering public response to Kerry’s speech Wednesday. What the secretary of state did, Netanyahu charged, “was spend most of his speech blaming Israel for the lack of peace.”

7) Why does Israel care so much about this?

There is strong international consensus on the illegality of Israeli settlements. This is based on the Fourth Geneva Convention, which bans nations from the moving of populations into and the establishing of settlements in the territory of another nation won in war.

Israel’s right-wing government, however, disputes that settlements in East Jerusalem and the West Bank are illegal, and maintains that their final status should be determined in future negotiations on Palestinian statehood, not by the United Nations.

The government’s rightward shift toward a more pro-settlement stance in recent years is in part a result of the rapid growth of Israel’s settler population.

According to data from Israel’s Central Bureau of Statistics, the annual growth rate for the settler population (excluding East Jerusalem) in 2013 was more than two and a half times higher than that of the overall population in Israel: 4.4 percent and 1.9 percent, respectively. Kerry, in his speech Wednesday, noted that the number of Israeli settlers in the West Bank, not including East Jerusalem, has increased by nearly 270,000 since the Oslo peace accords (signed in 1993 and 1995), including 100,000 just since 2009, when Obama took office.

As Vox’s Johnny Harris notes, “Over time, and especially as Israeli politics has shifted rightward, the settler movement has become an institutionalized part of Israeli society.”

But there’s another reason the Israeli government cares so much about what happens at the United Nations in particular: Netanyahu’s government believes that the United Nations, and the international community more generally, is biased against Israel, and that it unfairly singles out Israel for censure while ignoring egregious actions by other countries.

This argument is not without merit. Indeed, UN Secretary General Ban Ki-moon, who is stepping down at the end of this year after having served two five-year terms, told the Security Council earlier this month that "[d]ecades of political maneuvering have created a disproportionate number of resolutions, reports and committees against Israel,” and said that “[i]n many cases, instead of helping the Palestinian issue, this reality has foiled the ability of the UN to fulfill its role effectively."

This latest action by the UN, then, is interpreted by the Israeli government as part of a broader campaign to delegitimize Israel on the international stage. That the United States, Israel’s closest and most powerful ally, stood aside and let the resolution pass — and, according to Netanyahu, may have even been instrumental in bringing the measure to the Security Council in the first place — makes it even more painful.

8) Could Trump overturn the resolution when he takes office?

Trump has indicated that after he takes office on January 20, “things will be different” at the United Nations.

not anymore. The beginning of the end was the horrible Iran deal, and now this (U.N.)! Stay strong Israel, January 20th is fast approaching! — Donald J. Trump (@realDonaldTrump) December 28, 2016

And once in office, Trump could theoretically repeal the resolution by introducing a new resolution at the UN that completely revokes this one. He would then need to get at least eight other countries to vote for it, as well as ensure that none of the Security Council's other permanent members — Russia, the United Kingdom, France, and China — veto it.

Trump's pick to be the next US ambassador to the UN, Nikki Haley, would almost certainly support such a move. Haley is perceived as being staunchly pro-Israel: As governor of South Carolina, she passed legislation against the so-called BDS (boycott, divest, sanctions) movement — an international campaign aimed at punishing Israel economically for its actions and policies toward the Palestinians.

She also publicly supported Netanyahu's objections to the Iran nuclear deal when she delivered the Republican Party's official response to Obama's last State of the Union back in January. Haley said that if the GOP were to control the White House, “we would make international agreements that were celebrated in Israel and protested in Iran, not the other way around."

But it is extremely unlikely that Haley and the Trump administration would actually be able to get eight other countries on the Security Council to support a measure revoking this most recent resolution. That’s because, as mentioned above, the notion that Israeli settlements are illegal under international law is widely held by UN member countries.

Finally, even if the Trump administration did manage to get eight other countries to support such a measure, a permanent member veto would be likely, as Russia, China, Britain, and France — all of whom have veto power — all supported Friday’s measure, which passed 14-0.

9) What does this mean for US-Israel relations going forward?

Republican lawmakers immediately condemned the UN resolution and threatened consequences. Sen. Lindsey Graham, who heads the Senate panel in charge of US payments to the UN, said he would “form a bipartisan coalition to suspend or significantly reduce” funding. He added that countries receiving US aid could also be penalized for supporting the resolution.

Sen. Ted Cruz vowed on Twitter to cut US funding to the United Nations until the vote is reversed.

An array of powerful Democrats have also condemned the move. Sen. Chuck Schumer, the incoming Democratic minority leader, took to Twitter to argue that it was “[e]xtremely frustrating, disappointing & confounding that the Administration has failed to veto the UN resolution.”

Rep. Eliot Engel of New York, the ranking Democrat on the House Foreign Affairs Committee, said he was "very disappointed by the United States’ acquiescence to a one-sided, biased resolution at the United Nations Security Council."

“This resolution places the blame for the current impasse in negotiations entirely on Israel, asking nothing of the Palestinians," Engel added.

However, by directly accusing the Obama administration of being behind this UN move, Israeli officials made the fight personal.

As Vox’s Yochi Dreazen explains, “That puts Israel’s allies in the Democratic Party in a bind. Many of those lawmakers would normally condemn the UN vote, but Netanyahu’s attacks on Obama mean that criticizing the measure would look like they were criticizing their own president, too.”

“Netanyahu has also publicly embraced the incoming administration to a degree never done before by an Israeli leader,” writes Dreazen, “leaving no doubt that he believes the new president will be friendlier to his country than Obama had been.”

President-elect Trump, thank you for your warm friendship and your clear-cut support for Israel! @IvankaTrump @DonaldJTrumpJr https://t.co/lURPimG0wS — Benjamin Netanyahu (@netanyahu) December 28, 2016

Kerry spent much of his speech repeatedly noting his personal support for Israel, and stressing that “[n]o American administration has done more for Israel’s security than Barack Obama’s.”

“Regrettably, some seem to believe that the US friendship means the US must accept any policy, regardless of our own interests, our own positions, our own words, our own principles,” Kerry said, adding, “Friends need to tell each other the hard truths, and friendships require mutual respect.”

“This administration has been Israel’s greatest friend and supporter,” he insisted. The ferocity of Netanyahu’s response, however, showed that those feelings don’t appear to be mutual.

Watch: The Israel-Palestine conflict, explained