A motley alliance of Israeli parties on Sunday ousted Benjamin Netanyahu, the country’s longest-serving prime minister, and formed a new government in a seismic shift in the country’s turbulent politics.

Naftali Bennett, a right-wing Jewish nationalist and former tech millionaire was to take over at the helm of the eight-party bloc, united only by their shared disdain for the hawkish right-wing leader known as Bibi.

Netanyahu, 71, in typically combative style, vowed shortly before his defeat that “if it’s our destiny to be in the opposition, we’ll do so with our heads high until we take down this bad government and return to lead the country our way”.

Beloved as “King Bibi” by his right-wing supporters and condemned as the “crime minister” by his critics, Netanyahu has long been the dominant, and increasingly divisive, figure in Israeli politics.

But on Sunday, a vote in the Knesset legislature following weeks of intense political drama ended his government with a razor-thin majority of 60 to 59 in the 120-seat chamber.

In Tel Aviv’s Rabin Square, Netanyahu’s opponents broke out in cheers and launched into an evening of joyous celebrations, having rallied in recent days with “Bye bye Bibi” placards.

One of the demonstrators, Tal Surkis, 19, confessed to “mixed feelings” about the incoming change coalition, but said “it’s something Israel needs”.

Bennett, 49, in a Knesset speech before the vote, promised the new government, a coalition of ideologically divergent parties, “represents all of Israel”.

He said the country, after four inconclusive elections in under two years, had been thrown “into a maelstrom of hatred and in-fighting”.

“The time has come for different leaders, from all parts of the population, to stop, to stop this madness”, he said, to angry shouts of “liar” and “criminal” from right-wing opponents.