The dramatic announcement by opposition leader Yair Lapid and his main coalition partner, Naftali Bennett, came moments before a midnight deadline.

It prevented the country from plunging into what would have been its fifth consecutive election in just over two years.

Mr Netanyahu’s Likud won the most seats in the March 23 election, but he was unable to form a majority with his traditional religious and nationalist allies.

Crucially, a far-right party allied with Mr Netanyahu refused to join forces with a small Arab party that emerged as one of the kingmakers in the race.

In a statement on Twitter, Mr Lapid said he had informed the country’s president of the deal.

“This government will work for all the citizens of Israel, those that voted for it and those that didn’t. It will do everything to unite Israeli society,” he said.