Israeli Prime Minister Benjamin Netanyahu and his election rival, leader of the Blue and White party Benny Gantz, have agreed to form an emergency coalition government, a joint statement from their parties says.

“At this hour, an agreement on the establishment of an emergency national government between Prime Minister Benjamin Netanyahu and Benny Gantz, the chairman of the Blue and White alliance, was signed,” the statement read.

Israeli media have reported that under the deal, Netanyahu will remain the prime minister for 18 more months, while Gantz will be the defense minister and will subsequently replace Netanyahu.

The agreement comes following three elections in Israel in one year, in April and September 2019 and on March 2 when none of the political parties managed to win a majority in parliament and form a new government.

Last week, Israeli President Reuven Rivlin tasked Knesset members with picking a new head of government after the mandate he had given to the Blue and White Party leader Benny Gantz to form a coalition government expired.

Netanyahu and Gantz have made several attempts to reach an agreement on a coalition government after each round of elections but their efforts were not enough to end the political deadlock in the country. On April 15, they held talks for 11 hours straight but failed to overcome disagreements they had concerning the appointment of officials to the judiciary.