Avigdor Liberman and Aryeh Deri, the longtime kingmakers of Israeli politics, just had a very bad week. After lending their considerable political weight to the failed campaign of Moshe Lion for mayor of Jerusalem, they now face a wave of speculation about their declining influence — and even about their once-vaunted political acumen.

The Lion-centered alliance between the two — Liberman the avowed secularist, and Deri the leader of the largest of Israel’s Haredi parties — was already strange enough to produce much head-scratching. Both Liberman and Deri are famously savvy politicians who built long-standing fiefdoms and weathered political crises that would have felled lesser men.

Why, then, did they engage in the Lion adventure, and why did they embark upon it together?

“The reason Liberman and Deri backed Lion remains a mystery,” political analyst and Jewish Journal political editor Shmuel Rosner wrote in the International New York Times Thursday. “We’re left to assume it was an attempted power grab by two shrewd national politicians.”

The more you think about it, the stranger the alliance becomes. Jerusalem’s incumbent Mayor Nir Barkat was the favorite from the start. Lion’s only hope for victory lay in mobilizing wall-to-wall Haredi support. Why did Deri believe he could unite Jerusalem’s disparate Haredi factions in the service of the staunchest secularist in the Knesset, the Russian-speaking Liberman? And once it was clear in the weeks preceding the vote that Deri had failed to cobble together an anti-Barkat Haredi alliance, why did Liberman double down in his support for Lion in the crucial final days, even going so far as to hurl slurs at Barkat, publicly labeling him a racist?

These are strange mistakes for such cunning and experienced politicians.

But they were perhaps understandable mistakes, since both Deri and Liberman were acting out of desperation. Each badly needed a victory.

Deri leads a divided, confused party reeling from the death earlier this month of its founder and charismatic spiritual leader Rabbi Ovadia Yosef. Deri’s primary opponent in the party, the recently deposed chairman Eli Yishai, retains the allegiance of a majority of the party’s MKs, and speculation is rife about a possible split of the Knesset faction.

To shore up his base and his shaky political position, Deri fought hard in recent weeks to deliver two grand victories in Tuesday’s local elections: One that would show he was a decisive force on the national stage, and another that would reaffirm that he could deliver victories for his Sephardi Haredi base. For the former, he chose the race in Jerusalem; for the latter, in the Haredi city of Elad.

Elad, 30 minutes’ drive east of Tel Aviv, was a uniquely appropriate proving ground for Deri’s influence: a Haredi city of some 38,000 with a Sephardi majority; an election taking place just weeks after the death of the much-loved Yosef; a history of anti-Sephardi acts by Ashkenazi religious authorities in the city, including the exclusion of Sephardi girls from Ashkenazi schools, that plays well for Shas’s brand of identity politics; and an opponent hailing from the upper echelons of the Ashkenazi political elite, the son of United Torah Judaism MK Meir Porush. (Porush, incidentally, just so happens to be the candidate Barkat defeated to become Jerusalem mayor in 2008.)

Deri campaigned heavily for Shas’s candidate Victor Krispal, just as he campaigned vigorously in Jerusalem for Moshe Lion. And, as in Jerusalem, he lost by a narrow margin in Elad, this time to the victorious Yisrael Porush.

The defeat was a surprise. Shas garnered a plurality of the votes in Elad in January’s Knesset elections, winning 46% of the vote to UTJ’s 36%. Nine months later, with nearly identical turnout — 14,367 in January to 14,434 in October — Shas, and Deri, couldn’t deliver on their home turf. Porush beat Krispal by 562 votes.

The numbers tell a similar story in Jerusalem. Nir Barkat won 106,316 votes, just 12,039 more than Moshe Lion. That’s a strikingly narrow margin of victory, especially considering that United Torah Judaism won 53,631 votes in Jerusalem in January’s Knesset elections, more than any other party.

In other words, Barkat could not have carried Jerusalem without winning part of the Ashkenazi Haredi vote Deri courted so assiduously, and, worse still, Porush could not have won in Elad without at least a few Sephardi votes drawn from deep inside Deri’s political base.

To be sure, Liberman’s political position is no less dire. He’s trapped in an uncomfortable political limbo, unable to assume his cabinet post as foreign minister until he is exonerated of breach-of-trust and fraud charges. (The verdict in his trial is expected on November 6.)

If he is found guilty of a crime that carries “moral turpitude,” he will be forced to leave politics for seven years. If he is found innocent, or at least guilty of relatively minor crimes, he will return to the political system and face what may be his most difficult political crisis yet.

Yisrael Beytenu suffered badly in the polls after it teamed up to run as a joint Knesset list with the Likud. From over 40 seats promised to the joint list in polls taken immediately after the union was announced in October last year, the Likud-Beytenu list slowly dropped in polls as voters reacted to the news, eventually winning just 31 combined Knesset seats.

Liberman originally sought the merger with an eye toward eventually joining the Likud and merging his party machine, which is completely dependent on and loyal to him, with the Likud’s party institutions. Such a merger would likely have made him the most powerful man in the Likud after Prime Minister Benjamin Netanyahu, and a potential candidate for prime minister in the coming elections. But Liberman has faced stiff resistance to appointing his loyalists to the Likud Central Committee, and has failed to find allies within the Likud who might be willing to support such a merger.

Hurt electorally by the joint list and simultaneously rejected by the Likud’s party machine, Liberman is now looking for an opportunity to separate from the Likud, find ways to distinguish himself from the ruling party and begin to rebuild the constituency that abandoned him in January.

Liberman badly needed a clear-cut triumph in Tuesday’s elections that would give him the political window to engineer a split from the Likud from a position of strength.

Such political plans also help to explain another riddle of the local elections: not why Liberman or Deri campaigned for Lion, but why Netanyahu failed to do so. Lion was the Likud’s official candidate to lead Israel’s capital city, and Netanyahu is the Likud’s chairman. Netanyahu campaigned actively for other Likud candidates, including in relatively out-of-the-way towns like Hadera.

Some have suggested it was Netanyahu’s influential wife, Sara, who convinced him to tacitly support Barkat by denying his support for Lion. Sara and Barkat are friends, these commentators noted. But it’s hard to take the suggestion at face value. Sara Netanyahu has served as a kind of political scapegoat for Israeli pundits, offering an easy explanation for any act on Netanyahu’s part whose logic is not immediately apparent to the commentariat.

It is far more likely that Netanyahu’s refusal to support Lion is rooted in the looming crisis with Liberman.

And it may turn out to be a formidable crisis indeed. If Yisrael Beytenu steps out on its own, it can only rebuild its relevance and its lost constituency at the expense of the other members of the coalition. Liberman will work hard to show he is more hawkish than Jewish Home chairman Naftali Bennett and more secularist than Yesh Atid’s Yair Lapid. He will seek to torpedo the peace talks, effectively turning against the Netanyahu government’s official policy and driving a wedge with Tzipi Livni’s Hatnua.

In short, he will necessarily become a destabilizing factor in the coalition, eager to campaign against his ostensible coalition partners in an effort to regain his faded stature as Israel’s right-wing kingmaker.

The notion that Liberman would openly team up with Deri in order to win a dramatic victory in Jerusalem that would grant him the political opportunity to abandon Netanyahu and seek his political fortunes elsewhere, thereby destabilizing the coalition and threatening the prime minister’s sitting government, would have seemed far fetched only a few months ago. Now it’s being openly discussed, including by Deri himself.

“Avigdor Liberman is the central axis of this coalition. You cannot break up this coalition without Avigdor Liberman,” Deri told the Shas-affiliated radio station Kol Baramah in mid-October, apparently in the belief that the national press would not notice his comments to a Haredi media outlet.

The goal of the Shas-Yisrael Beytenu alliance, Deri told the radio station, was to unseat the Netanyahu government before it succeeded in forcing Haredim into military or national service.

Even if Lion lost the election, Deri added, “Liberman is with us together in this alliance, which he knows we entered together with him in partnership. Partnerships and agreements are not only done on paper.”

The most bitter pill of all

On Wednesday, after all the votes were counted and the bitter defeat became undeniable, Liberman took to Facebook to lament Barkat’s supposed hoodwinking of “the good Jerusalemites.”

“The thing that truly saddens me is all the good Jerusalemites who were taken in by Barkat’s dishonest campaign and are now discovering who really made ‘deals’ and sold Jerusalem to the Haredim,” he wrote.

His comment included a link to a Channel 10 report that suggested Barkat had cut a secret deal with Ashkenazi Haredi mayoral candidate Chaim Epstein in which Epstein was allegedly guaranteed a place in his coalition, together with a salaried deputy mayorship (ordinary city council members do not earn a salary; deputy mayors do), in exchange for Epstein staying in the running to the end of the race. Epstein won 7,428 votes on Tuesday, helping to further divide the Haredi vote.

Channel 10 claimed the existence of the deal was confirmed by a Barkat spokesperson, though Barkat’s office denied any such agreement existed in a Thursday statement to The Times of Israel.

But even if Liberman and Channel 10 were right and such a deal was struck, it offers scant consolation for the fading political heavyweights. It suggests that Liberman and Deri were not merely outdone by the inscrutable will of the voters, but that they were outmaneuvered by Barkat, a relative political neophyte.

October was a dramatic month for Israeli politics, and its effects will likely be felt for years to come. Peace talks seem to be picking up steam, to judge by the frequency of meetings between Israeli and Palestinian negotiators. Rabbi Ovadia Yosef’s death and the revelation of Deri’s political weakness leave Shas’s political future in grave doubt. And Liberman’s electoral decline and post-verdict preparations suggest a turbulent time ahead for Israel’s ruling government.