A motley alliance of Israeli parties on Sunday 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.

A combination of pictures created on June 2 shows the heads of Israel's newly-announced 'change' coalition who are united by their hostility to Benjamin Netanyahu, Israel's longest-serving prime minister whose rule could end on Sunday
A combination of pictures created on June 2 shows the heads of Israel's newly-announced 'change' coalition who are united by their hostility to Benjamin Netanyahu, Israel's longest-serving prime minister whose rule could end on Sunday AFP / Emmanuel DUNAND

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 Sunday, 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.

On Saturday night anti-Netanyahu protesters rallied outside his Jerusalem home to celebrate what they believe will be his departure from office
On Saturday night anti-Netanyahu protesters rallied outside his Jerusalem home to celebrate what they believe will be his departure from office AFP / EMMANUEL DUNAND

US President Joe Biden swiftly congratulated Bennett.

"I look forward to working with Prime Minister Bennett to strengthen all aspects of the close and enduring relationship between our two nations. Israel has no better friend than the United States," he said in a statement.

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

Composition of the Israeli parliament after the March 23 parliamentary elections and parties in the coalition announced on June 2
Composition of the Israeli parliament after the March 23 parliamentary elections and parties in the coalition announced on June 2 AFP / Kenan AUGEARD

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.

Sundays' vote comes on the heels of an 11-day war between Israel and Palestinian militants in Gaza
Sundays' vote comes on the heels of an 11-day war between Israel and Palestinian militants in Gaza AFP / MOHAMMED ABED

Bennett, 49, told the Knesset before the vote that his government "represents all of Israel".

Composition of the Israeli parliament after the March 23 parliamentary elections and parties in the coalition announced on June 2
Composition of the Israeli parliament after the March 23 parliamentary elections and parties in the coalition announced on June 2 AFP / Kenan AUGEARD

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.

Israeli Prime Minister Benjamin Netanyahu pictured on June 6 during a health ministry ceremony in Jerusalem
Israeli Prime Minister Benjamin Netanyahu pictured on June 6 during a health ministry ceremony in Jerusalem AFP / Menahem KAHANA

His supporters have hailed him as a defender of Israel who has been tough on archfoe 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.

An Israeli protester mimics wiping a tear off a poster depicting Prime Minister Benjamin Netanyahu during a demonstration against him in front of his residence in Jerusalem on June 12
An Israeli protester mimics wiping a tear off a poster depicting Prime Minister Benjamin Netanyahu during a demonstration against him in front of his residence in Jerusalem on June 12 AFP / EMMANUEL DUNAND

Netanyahu claimed Iran saw "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.

Composition of the Israeli parliament after the March 23 parliamentary elections and parties in the coalition announced on June 2
Composition of the Israeli parliament after the March 23 parliamentary elections and parties in the coalition announced on June 2 AFP / Kenan AUGEARD

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

German Chancellor Angela Merkel on Sunday congratulated Bennett in comments tweeted by her spokeswoman: "Germany and Israel are connected by a unique friendship that we want to strengthen further. With this in mind, I look forward to working closely with you."

Canadian Prime Minister Justin Trudeau sent a message of congratulations, adding that Ottawa "remains steadfast in its commitment to a two-state solution, with Israelis and Palestinians living in peace, security, and dignity - without fear and with their human rights respected".

Israeli Prime Minister Benjamin Netanyahu and Defence Minister Benny Gantz make their way to the Knesset Plenum to attend the voting session on a new government
Israeli Prime Minister Benjamin Netanyahu and Defence Minister Benny Gantz make their way to the Knesset Plenum to attend the voting session on a new government AFPTV / Ahikam SERI

British Foreign Secretary Dominic Raab tweeted: "I look forward to continued cooperation on security, trade and climate change, and working together to secure peace in the region."

European Council president Charles Michel also tweeted his congratulations.

The improbable alliance emerged weeks after an 11-day war between Israel and Hamas, the Islamist group that rules the Palestinian enclave of Gaza, and following inter-communal violence in Israeli cities with significant Arab populations.

Netanyahu, a mastermind at navigating Israel's fractious politics, had tried in vain to peel off defectors, hoping to deprive the nascent coalition of its hard-won majority.

He accused Bennett of "fraud" for siding with rivals. Angry rallies by the premier's Likud party supporters resulted in security being bolstered for some lawmakers.

As his grip on power slipped, Netanyahu's bombastic remarks drew parallels to former US president Donald Trump, who described his election loss last year as the result of a rigged vote.

Sunday's Knesset approval also came amid heightened tensions with the Palestinians.

Right-wing Israelis are also angered over last week's postponement of a controversial Jewish nationalist march through flashpoint areas of east Jerusalem.

The "March of the Flags" is now slated for Tuesday, representing a key early test for the new government.

"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."

mdo/har/jj