JERUSALEM — With just two days left before the deadline for forming a government, Prime Minister Benjamin Netanyahu of Israel was struggling Monday to sign up coalition partners, thrusting the country into a political crisis and raising the possibility that it could be forced to hold a new election.

The drama stemmed from a battle of wills between two political forces that Mr. Netanyahu needs to form a right-wing coalition: the ultra-Orthodox religious parties that won 16 parliamentary seats in the April 9 election, and Avigdor Lieberman’s ultranationalist Yisrael Beiteinu party, which won five seats and whose constituents are mostly secular, Russian-speaking Israelis.

Having long sparred over issues of religion and state, the sides are now wrestling over legislation to replace a military draft law that exempted ultra-Orthodox men. Mr. Lieberman supports a law that sets modest quotas for enlisting them, which the religious parties oppose.

A new law must be passed by late July, according to a deadline imposed by Israel’s Supreme Court.

Mr. Netanyahu’s conservative Likud party, which won 35 seats, needs the ultra-Orthodox parties, Yisrael Beiteinu and two other parties to assemble a 61-seat majority.