JERUSALEM - Israel's former military chief Benny Gantz was tasked Wednesday with forming the next government, but he has few options after last month's elections left him in a near tie with Prime Minister Benjamin Netanyahu.

Netanyahu was given the first opportunity to form a government after assembling a large right-wing bloc but announced this week that he had failed to build a 61-seat majority. Gantz faces similarly steep odds, raising the possibility that Israel will hold a third election in less than a year.

President Reuven Rivlin formally granted the mandate to Gantz, who will have 28 days to form a coalition. It is the first time in over a decade that anyone besides Netanyahu has been given the task.

Gantz vowed to form a 鈥渇unctioning鈥 unity government that would 鈥渟trive for peace but know how to defeat every enemy.鈥

A lifelong military man, Gantz has presented himself as a practical leader who can bridge Israel's many divisions and address the various security threats it faces. His low-key campaign was in sharp contrast to Netanyahu's, which was marked by breathless announcements about a suspected Iranian nuclear site and plans to annex large parts of the occupied West Bank.

Gantz also presents himself as a more trustworthy alternative to the scandal-plagued Netanyahu and may hope to evoke past generals who became statesmen, including Moshe Dayan, Yitzhak Rabin and Ariel Sharon.

But he faces steep odds in every possible path to forming a government. He has been endorsed by just 54 lawmakers representing an array of parties that are unlikely to sit together in a coalition.

Both Gantz and Netanyahu say they favour a national unity government. Together, Netanyahu's Likud and Gantz's Blue and White control a solid 65-seat majority. But the two men are divided over who should lead any new government.

Netanyahu has insisted he head the government, at least for the first two years, and that it include his right-wing allies, conditions that Gantz has repeatedly rejected.

Netanyahu is likely to be indicted on corruption charges in the coming weeks, and Gantz has said Netanyahu should resolve his legal troubles before returning to the top post.

Blue and White nevertheless invited Likud negotiators to a meeting planned for Thursday.

Addressing Netanyahu on Wednesday, Gantz called him a 鈥減atriot鈥 and said he hoped he could resolve his legal issues.

鈥淚t is clear to both of us that the elections outcome and the legal situation demand a change. Together with you and with the other good people at the Likud we must act with responsibility.鈥

One path for Gantz would be to try and break up Netanyahu's right-wing alliance and recruit some of the smaller parties to his coalition. But that might be seen as a major betrayal by those parties' voters.

Another option would be to form a minority government with Avigdor Lieberman, who emerged as kingmaker after his party won eight seats and has refused to endorse either Gantz or Netanyahu. Gantz might be able to convince the Arab Joint List, which won 13 seats, to support the coalition from the outside.

That would bring down Netanyahu but result in a highly unstable government. It's also far from clear that Lieberman, a nationalist with a history of harsh rhetoric toward the Arab minority, would support such a scheme. No Arab party has ever sat in an Israeli government.

The political deadlock dates back to April, when Lieberman refused to join a right-wing coalition under Netanyahu, denying him a majority. In response, parliament voted to dissolve itself, leading to an unprecedented repeat election in September. A similar scenario could play out again.

The political deadlock has delayed the Trump administration's release of its long-awaited peace plan. The Palestinians have already rejected the plan, accusing the administration of extreme and unfair bias toward Israel.

In giving Gantz the mandate, Rivlin once again implored Israel's political leaders to come together, saying there is 鈥渘o justification鈥 to impose a third election on the country.

鈥淚f a government is formed, it is true that everyone will pay a price,鈥 he said. 鈥淏ut if such a government is not formed, Israeli citizens will pay the heaviest price.鈥

----

Associated Press writer Isaac Scharf in Jerusalem contributed.