The office of Israel's president says Prime Minister Benjamin Netanyahu has been given the difficult task of forming a new government.

Wednesday's decision came after President Reuven Rivlin's attempts to broker a unity government between Netanyahu and his chief rival, Benny Gantz, failed.

Rivlin and Netanyahu were to give statements later Wednesday.

Netanyahu faces an uphill struggle. After a tight election, his Likud party, along with smaller allied parties, controls 55 seats, short of the required 61-seat majority in parliament.

His former ally, the Yisrael Beitenu party, refuses to sit in a government with Netanyahu's ultra-religious partners. And dovish opposition parties are unlikely to back Netanyahu.

NETANYAHU, GANTZ AGREE TO LAUNCH UNITY TALKS AFTER MEETING WITH ISRAEL'S PRESIDENT

He now has up to six weeks to form a coalition. If he fails, Gantz will likely be given a chance.

In this Thursday, Sept. 19, 2019 file photo, Blue and White party leader Benny Gantz, left, Esther Hayut, the Chief Justice of the Supreme Court of Israel, and Prime Minister Benjamin Netanyahu attend a memorial service for former President Shimon Peres in Jerusalem (AP)

According to final official results announced Wednesday, Blue and White finished first with 33 seats in the 120-seat parliament, just ahead of Likud's 32 seats. Even with the support of smaller allies, both parties are short of the required majority.

A total of 55 lawmakers have recommended that Netanyahu lead the next government, while 54 have lined up behind Gantz. The key power broker is Avigdor Lieberman, whose Yisrael Beitenu party controls 8 seats. Lieberman refused to endorse either candidate and is pushing for a unity government.

ISRAEL'S ARAB LAWMAKERS BACK NETANYAHU RIVAL, GANTZ, FOR PRIME MINISTER

Looming over the process is the corruption investigation against Netanyahu. Israel's attorney general has recommended charging Netanyahu with bribery, fraud and breach of trust in a series of scandals.

Netanyahu, who denies any wrongdoing, is to appear at a hearing with the attorney general next week, after which a final decision on charges is expected. Legal experts say the likelihood of an indictment is high.

CLICK HERE FOR THE FOX NEWS APP

Under Israeli law, the president's first choice is given up to six weeks to form a coalition. If he fails, he can choose an alternative candidate to try. After that, a majority of parliament could offer a third name to be prime minister. And if that fails, Israel would be forced into holding its third election in less than a year.