A motley alliance of Israeli parties on June 13 ended Benjamin Netanyahu’s 12 straight years as prime minister, as parliament voted in a new government led by his former ally, right-wing Jewish nationalist Naftali Bennett.

Bennett, a tech millionaire and former special forces commander, was sworn in at the helm of an ideologically divided eight-party bloc united only by disdain for the country’s longest-serving prime minister.

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” and “Mr Security” by his right-wing supporters and condemned as the “crime minister” by his critics, Netanyahu has long dominated Israeli politics.

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

Delighted revellers packed a square near the Knesset (parliament) in Jerusalem and poured into Tel Aviv’s city centre to celebrate Netanyahu’s fall.

Throngs of people gathered in the coastal city, clapping, cheering and waving flags.

In Tel Aviv’s Rabin Square, Netanyahu’s opponents launched into celebrations, waving “Bye bye Bibi” placards.

Bennett, 49, told the Knesset before the vote that his government “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.

Netanyahu, who is battling corruption charges in a trial he dismisses as a conspiracy, has been the dominant Israeli politician of his generation, having also served a previous three-year term in the 1990s.

His supporters have hailed him as a defender of Israel who has been tough on arch-foe Iran, but who also struck a series of historic normalisation deals with Arab nations last year.

Being ousted from the top job leaves Netanyahu more exposed to his legal troubles, denying him the chance to push through legislation that could give him immunity.

Bennett, a former defence minister under Netanyahu, vowed to keep Israel safe from Iran, promising that “Israel won’t let Iran have nuclear weapons”, a goal the Islamic republic denies pursuing.

Netanyahu claimed Iran was seen “celebrating” the birth of a “dangerous”, weak left-wing government.

The diverse anti-Netanyahu bloc was cobbled together by the secular centrist Yair Lapid, a former TV presenter.

It spans the political spectrum, with three right-wing, two centrist and two left-wing parties, and even an Arab Islamic conservative party.

Lapid, 57, is to serve as foreign minister for the next two years before taking over from Bennett.

Gaza’s rulers Hamas said political developments in Jerusalem wouldn’t change their position on Israel.

“The form the Israeli government takes doesn’t change the nature of our relationship,” said the group’s spokesman Fawzi Barhoum.

“It’s still a colonising and occupying power that we must resist.”