Israel's parliament has passed a law that drafts ultra-Orthodox Jewish men into the army, ending their 65-year exemption from national service.

The Knesset vote on Wednesday, which was boycotted by opposition parties, followed a cabinet decision last year to end a practise that excluded ultra-Orthodox Jews, or Haredim, from national service if they were studying full-time at a seminary, or yeshiva.

One politician, Ayelet Shaked, said during the debate: "For 65 years there was an exemption for all yeshiva students and the change the coalition made is proportionate and gradual and correct. If there will be cooperation from haredi leadership, there will not be mandatory enlistment."

The new law, which comes into force in 2017, means that ultra-Orthodox Jews must either join the army or perform a civilian service. It also includes penalties, including imprisonment, for those attempting to evade conscription.

The Equal Service Bill has angered the Haredim, who have been protesting in their thousands that they are being punished for practising their faith.

Haredim, which means "those who tremble before God" in Hebrew, make up about 10 percent of Israel's population of eight million. They are a fast-growing and relatively poor social group.

The community has been accused of enjoying state benefits without sharing in the duties imposed on others. Military service is compulsory in Israel, with men serving three years and women two.