Israeli prime minister Benjamin Netanyahu’s government agreed on Wednesday to hold early elections in April after the ruling coalition appeared to come up short on votes needed to pass a contentious piece of legislation.

Netanyahu said his coalition “unanimously” agreed to disband the government and hold a new election. At a meeting of his Likud party, he listed his accomplishments in office and said he hoped his current religious, nationalistic coalition would be the “core” of the next one as well.

The latest polls appear to predict another solid victory for Netanyahu, although an indictment over mounting corruption charges could still trip him up.

Netanyahu’s coalition has been riven by internal divisions for months. Avigdor Lieberman resigned as defence minister last month to protest against what he perceived to be the government’s weak response to rocket attacks from Hamas-ruled Gaza.

But a new law extending the military draft to ultra-Orthodox men appears to have triggered the government’s downfall. Netanyahu’s ultra-Orthodox partners are demanding the legislation be weakened and his razor-thin parliamentary majority seems to be making such a compromise impossible.

Ultra-Orthodox parties consider conscription a taboo, fearing that military service will lead to immersion in secularism. But years of exemptions have generated widespread resentment among the rest of Jewish Israelis. Earlier on Wednesday, Yair Lapid of the opposition Yesh Atid party announced he was rescinding his support for the bill, calling the coalition’s hoped-for compromise a payoff to draft dodgers.

As a result, Netanyahu convened his fellow coalition leaders and the decision was made to dissolve parliament and go to elections.

Another victory for Netanyahu would assure his place in history as Israel’s longest-serving leader and allow him to solidify his close alliance with the US president, Donald Trump. Another term would also allow Netanyahu to push forward with his nationalistic agenda and worldwide campaign to thwart Iran’s nuclear ambitions.

With the opposition parties currently splintered, the only thing that seems to stand in his way is potential criminal charges over his bevy of corruption allegations. Police have recommended he be indicted on bribery and breach of trust charges in three different cases. The country has long been eagerly awaiting the attorney general’s decision on whether to press charges.

The justice ministry announced on Wednesday that deliberations were continuing and were “not dependent on political events”.

Netanyahu has angrily dismissed the accusations against him, characterising them as part of a media-driven witch-hunt that is obsessed with removing him from office.

Elections were previously scheduled for November 2019. But since Lieberman’s resignation, the coalition has been relying on the slimmest of parliamentary majorities, just 61 out of its 120 members, and has found governing difficult.

The last time a government served its full term was in 1988. Since then, elections have almost always been moved up because of a coalition crisis or as a strategic move by the prime minister to maximise his chance of re-election.