OTTAWA -- The Supreme Court of Canada has ruled that Quebec infringed on the religious freedom of a Catholic high school in Montreal by requiring it to teach the province's ethics and religious culture program.

But the high court was divided by a 4-3 margin on how to resolve the clash between religious freedom and the need to follow the secular law of the province.

A vocal minority, led by Chief Justice Beverley McLachlin, said they didn't think the majority struck the right balance between protecting freedom of religion and the need to follow the law.

In the narrowest legal sense, the ruling grants the appeal by Jesuit-run Loyola High School, which wants to be allowed to use its own course and teach the province's Ethics and Religious Culture program from a Catholic perspective.

The school can now reapply to Quebec's education ministry for an exemption to teach the ERC program and that decision must be guided by Thursday's ruling.

The ruling comes amid the backdrop of political, cultural and religious acrimony that has arisen in Ottawa around the issues raised by Prime Minister Stephen Harper's position that women taking the oath of citizenship should not be allowed to wear a face-covering niqab.

The high court ruled on the issue in 2012 in a similar case in Drummondville, Quebec involving a public school.

In that case, the Supreme Court ruled that teaching students about world religions did not infringe the rights of Catholic parents who wanted to raise their children in their faith.

Today's case revolves around Quebec's law that requires schools to teach religions from a secular, cultural and morally neutral perspective in private schools.

The ministry initially turned down Loyola's request for an exemption, but at trial, a judge in the Superior Court of Quebec ruled in favour of the school and granted it.

The Quebec Court of Appeal reversed that decision, saying that even if there was, the effect was trivial because the ethics course was one among many.

That ruling was overturned by the Supreme Court Thursday.

Schools can apply for an exemption that allows an alternative course to be taught as long as the minister of education approves it. Schools are only allowed to teach an alternative course as long as teachers steer clear of injecting their own religious beliefs.

"To ask a religious school's teachers to discuss other religions and their ethical beliefs as objectively as possible does not seriously harm the values underlying religious freedom," wrote Justice Rosalie Abella for the majority.

"But preventing a school like Loyola from teaching and discussing Catholicism in any part of the program from its own perspective does little to further those objectives while at the same time seriously interfering with the values underlying religious freedom."

Loyola's exemption, the court held, "cannot be withheld on the basis that Loyola must teach Catholicism and Catholic ethics from a neutral perspective."

However the minority opinion, penned by McLachlin, took issue with how all of this would play out in a practical sense in a classroom.

"Requiring Loyola's teachers to maintain a neutral posture on ethical questions poses serious practical difficulties and represents a significant infringement on how Loyola transmits an understanding of the Catholic faith," McLachlin wrote.

That would prove difficult in the context of the inevitable class discussion that would arise, she said.

"Faced with a position that is fundamentally at odds with the Catholic faith, Loyola's teachers would be coerced into adopting a false and facile posture of neutrality.

"The net effect would be to render them mute during large portions of the ethics discussion - a discussion that is, as the ERC Program presupposes, crucial to developing a civilized and tolerant society."