OTTAWA - A sharply divided Supreme Court of Canada was not able to definitively rule Thursday whether a woman can wear a religious veil known as a niqab while testifying in court.

In a rare 4-2-1 split decision, the Supreme Court ruled that a witness can cover their face in certain circumstances.

The case pitted two protections in the Charter of Rights and Freedoms against each other — religious freedom versus an accused person's right to a fair trial.

In the end, a slim majority decided essentially not to favour one over the other: the court affirmed the importance of both rights.

The practical effect of that decision was to pass the case back to an Ontario trial judge that had just begun a preliminary hearing.

In this case, a Muslim woman sought to wear a niqab while testifying against two men she claims sexually assaulted her when she was a child.

The two men claim the Charter allows them to confront their accuser and observe her facial expressions as she testifies. Due to a publication ban, the woman can only be identified as N.S.

Chief Justice Beverley McLachlin wrote for the majority and affirmed the two Charter rights, saying both should receive the fullest possible expression.

McLachlin spelled out a four-step analysis that the judge at N.S.'s preliminary hearing can now use to determine the issue. The ruling will also be a precedent in other cases.

"The judge must assess all these factors and determine whether, in the case at hand, the salutary effects of requiring the witness to remove the niqab outweigh the deleterious effects of doing so."

The ruling told trial judges to ask themselves three questions: Would requiring the witness to remove the niqab while testifying interfere with her religious freedom? Would permitting the witness to wear the niqab while testifying create a serious risk to trial fairness? Is there a way to accommodate both rights and avoid the conflict between them?

Only then, the ruling stated, can a trial judge order a witness to remove their veil.

"At this point, however, it may be ventured that where the liberty of the accused is at stake, the witness's evidence is central to the case and her credibility vital, the possibility of a wrongful conviction must weigh heavily in the balance, favouring removal of the niqab," McLachlin wrote.

Two other justices, Marshall Rothstein and Louis LeBel, disagreed. They said a covered face has no place in the witness box.

"A clear rule that niqabs may not be worn would be consistent with the principle of openness of the trial process and would safeguard the integrity of that process as one of communication. It would also be consistent with the tradition that justice is public and open to all in our democratic society," they wrote.

A lone justice, Rosalie Abella, said a witness should be allowed to cover their face, as long as their identify was not at issue.

"The court system has many examples of accepting evidence from witnesses who are unable to testify under ideal circumstances because of visual, oral, or aural impediments. I am unable to see why witnesses who wear niqabs should be treated any differently," Abella wrote.

In the majority ruling, McLachlin acknowledged that the matter was a legal work-in-progress.

"Future cases will doubtless raise other factors, and scientific exploration of the importance of seeing a witness's face to cross-examination and credibility assessment may enhance or diminish the force of the arguments made in this case."

The controversial issue has also divided the Muslim community. It has also reared its head in recent years, leading to a new law in Quebec for public sector workers and new federal immigration rules that ban face coverings while taking the oath of citizenship.