It’s a the-chicken-or-the-egg question. Which came first: the Obama administration’s public contempt toward our allies in Jerusalem, or liberal Democratic animosity toward Israel?

Either way, when Barack Obama steps down as president in January 2017, the Democratic Party he leaves behind will be one whose sympathies no longer embrace the Jewish state.

It’s an extraordinary legacy. And it’s underscored by the more or less constant snubs President Obama has directed at Prime Minister Benjamin Netanyahu.

Of course, world leaders not getting along is nothing new. As Churchill’s wartime liaison to de Gaulle said of Britain’s French ally, “The greatest cross I have had to bear is the Cross of Lorraine.”

But the case of Obama and Netanyahu is much more than a clash of personalities. It’s a conflict between two competing worldviews. And if a poll released this month by the Pew Research Center is any clue, this conflict has now become embedded in American party politics.

Pew asked a basic question: “In the dispute between Israel and the Palestinians, who do you sympathize with more?”

Overall, Pew found a slim majority of Americans, 51 percent, sympathize more with Israel. But the breakdown by party is where it gets interesting:

Basically, support for Israel gets stronger as you move right, and weaker as you move left: 77 percent of conservative Republicans support Israel, against 64 percent for moderate Republicans. In sharp contrast, just 48 percent of moderate Democrats support Israel, and only 39 percent of liberal Democrats.

To slice it another way, support for Israel is a minority opinion in the Democratic Party. Pew adds that “the partisan gap in Mideast sympathies” reflected in the poll “has never been wider.”

Now, some complain the wording of the question doesn’t quite support the conclusion the party has become anti-Israel. All these Americans are saying, goes this claim, is that Palestinians are more downtrodden.

This is wishful thinking. For one thing, the Pew findings are consistent with a just-released Gallup Poll reporting that while 65 percent of Republicans say Israel’s actions against Hamas are justified, only 36 percent of Democrats do.

These results don’t come in a vacuum. Remember how Democrats booed Israel at their 2012 national convention?

Party-platform drafters had dropped a plank from 2008 that said, “Jerusalem is and will remain the capital of Israel.” Party leaders intervened to restore the deleted language via a convention vote.

The jeers came when the convention chair — Los Angeles Mayor Antonio Villaraigosa — called for a voice vote on the amendment, and met with shouts of opposition. Villaraigosa had to ask three times, because the “no’s” were so loud. And he was roundly booed when he then declared the necessary two-thirds of delegates had voted for the change, when the “no’s” filling the hall suggested otherwise.

Both Obama’s policy and his personnel picks reflect these sentiments. Long before his secretary of state, John Kerry, sneered about the operation against Hamas, he’d used the loaded term “apartheid state” in reference to Israel’s future. Meanwhile, as defense secretary the president installed a man who could not bring himself to call Yasser Arafat a terrorist.

Israelis, of course, have lived through US presidents who were less than chummy. But give credit where credit is due: When on Yom Kippur 1973 a massive, Soviet-backed force of Syrian and Egyptian troops attacked Israel, Richard Nixon immediately airlifted the arms Israel needed to prevail. Can anyone imagine Obama doing the same — at least in time to make a difference?

Jimmy Carter wasn’t thought friendly, either, and his UN ambassador had to resign after it emerged he’d met secretly with the Palestine Liberation Organization. But Carter brokered the Camp David Accords, and his more vitriolic assertions about Israel came only after he’d left office.

Throughout all these years, American politics had plenty of liberal Democrats who strongly supported Israel. We still do. But they’ve become outliers.

Put it this way: While states and congressional districts with liberal Jewish populations may continue to send pro-Israel liberals to Washington, trends suggest these pro-Israel liberal Democrats will decline as anti-Israel liberal Democrats take their place.

Already, the anti-Israel liberals seem to wield the real power. For example, what does the president’s approach to the Middle East and Israel say about the influence of New York’s senior senator, Chuck Schumer?

The simplest explanation is that President Obama is giving his party what most of its members want. And years from now, we are likely to look back at the Obama era as the moment in American history when the Democratic Party shifted, openly and decisively, against Israel.