A panel of nine justices ruled that parts of the conscription law that exempt seminary students from service were "unreasonable and unconstitutional". It gave the government a year to resolve the matter.

For decades, the exemption from military service on religious grounds for seminary students has caused friction in Israeli society, where most Jewish men and women are called up for military service when they turn 18.

The ultra-Orthodox say that their study of the Torah is vital for the continued survival of the Jewish people and also fear that young men serving in the army would come into contact with women and with less pious elements in society.

Several hundred ultra-Orthodox men have, however, enlisted in special units that cater to their religious needs.

Legislation was enacted in 2014 to replace arrangements that had previously expired. It was prompted by then-coalition member Yair Lapid's secular, centrist Yesh Atid party which ran on a platform of "sharing the national burden".

That legislation angered ultra-Orthodox parties who rejoined Netanyahu's subsequent government in 2015 when Lapid's party went into opposition and they managed to effect a watering down of the law.

Eight of the nine justices ruled the law should be scrapped, and Supreme Court President Miriam Naor wrote that the most recent arrangement that was made to appease the ultra-Orthodox parties "deeply harms equality in a way that damages the constitutional right to human dignity".

Since Israel's founding in 1948, ultra-Orthodox politicians have campaigned vigorously against the conscription of members of their community, who make up about 10 percent of Israel’s population of 9 million.

Netanyahu's government, which controls 67 of the Knesset's 120 seats, includes both ultra-Orthodox parties, but two other influential factions oppose a further relaxation of the legislation against conscription.

Interior Minister Aryeh Deri, the leader of the ultra-Orthodox Shas party, said in response to the ruling that the justices were "completely detached from our heritage and tradition and from the people".

He encouraged seminary students to continue their Bible studies and said: "Do not despair, continue to study the Torah, we will stand firm and will do everything to fix this situation."

Lapid, whom opinion polls have shown to be a possible challenger to Netanyahu in future elections, convened a news conference to praise the court's decision, saying it had delivered a verdict that would force equality among communities.

"This is why we have come to politics. Conscription for everybody, work for everybody. Benjamin Netanyahu can no longer continue to wriggle out all the time. Military conscription is for everybody, not only for the suckers who don't have a party in his coalition," Lapid added.