A Muslim woman must remove her full-face veil when she gives evidence but may wear it at other times during her trial, a judge has ruled.

Judge Peter Murphy's compromise ruling, which involves screening her from public view in the court when she is not veiled, will set a precedent for how criminal courts deal with defendants who wear a traditional niqab.

The 22-year-old woman from London, referred to in the judgment only as D, says it is against her religious beliefs to show her face in public. She pleaded not guilty to a charge of witness intimidation last week while wearing a veil.

Directions for the trial at Blackfriars crown court, due to take place in November, will also prohibit courtroom artists from making any sketch or drawing of the defendant without her niqab. Only the judge, jury and legal counsel will be able to see D's face when she gives evidence.

Murphy, who received submissions from prosecution and defence, said there was no clear legal authority to resolve the problem. It had consequently "resulted in widespread judicial anxiety and uncertainty and a reluctance to address the issue". The niqab, he said, had become "the elephant in the courtroom".

He continued: "Whether or not there is an obligation to wear the niqab is not a subject of universal agreement within Islam; rather, it is a choice made by individual women on a personal basis." That choice, nonetheless, should be "respected as a manifestation of religion or belief".

The issue, the judge said, was how to balance the defendant's right to manifest her religion or belief, as set out by article 9 of the European convention on human rights, against the public interest in the courts conducting criminal proceedings "in accordance with the rule of law, open justice, and the adversarial trial process".

Necessary and proportionate restrictions could be imposed on religious freedoms, the judgment said. The European court of human rights, it noted, has recently upheld a ban on a nurse wearing a cross at work on safety grounds.

Murphy added: "The ability of the jury to see the defendant for the purposes of evaluating her evidence is crucial … The right to give evidence involves a corresponding duty to submit that evidence to the scrutiny of the jury."

Similar compromises have been established at airport security checks or when obtaining a passport, he said. The judge had earlier warned that the woman would have to show her face to be properly identified. However, he backed down last Thursday and permitted her to enter the dock after she had been identified in a private room by a female police officer.

The Metropolitan police constable, who was present when the defendant was photographed after her arrest in June, then swore on oath that it was the same woman in the dock.

A niqab covers the face, with a slit for the eyes. It is commonly worn in the Saudi Arabian peninsula and many other Muslim countries.

The National Secular Society objected to Murphy's ruling and said it would lodge an official complaint. "It is vital that defendants' faces are visible at all times, including while others are giving evidence, so we regret the judge's decision not to require this," said the organisation's executive director, Keith Porteous Wood. "We will be complaining to the Office for Judicial Complaints and also be asking senior legal officers to make visibility throughout court hearings mandatory, and not subject to judges' discretion."

The defendant's barrister, Susan Meek, had argued it would breach her client's human rights and be counter to Britain's tolerance of Islamic dress if she had to remove her veil against her wishes during the trial.

A niqab covers the face, with a slit for the eyes. It is commonly worn in the Saudi Arabian peninsula and many other Muslim countries.

The Muslim Council of Britain called for a "sensible, non-hysterical conversation" over the issue of the niqab following the ruling but added that women should be allowed to wear the veil if they want to.

"She is entitled to wear it in private and in public," Meek said last week. "That right to wear the niqab also extends to the courtroom. There is no legislation in the UK in respect of the wearing of the niqab. There is no law in this country banning it.

"The jury will be able to determine her demeanour while wearing the veil. Demeanour is not just how their mouth moves, it is how their head moves, their eyes move, their hands move. That will be fully visible to the jury and no bar to her giving evidence."

Liberty, which campaigns on civil liberties and human rights issues, said it welcomed the ruling. Director Shami Chakrabarti said: "Credit to Judge Murphy for seeking to balance the freedom of conscience of the defendant with the effective administration of justice.

"He has shown a sensitivity and clarity that can only further build confidence in our courts in Britain's diverse communities and around the world."

The judgment came on the day that the deputy prime minister, Nick Clegg, said he did not believe it was "appropriate" for students to wear a full veil in the classroom or for people to go through airport security with their faces covered.

Clegg told the BBC: "I think it is very un-British to start telling people what pieces of clothing they should wear. I think there are exceptions to that as far as the full veil is concerned – security at airports, for instance. It is perfectly reasonable for us to say the full veil is clearly not appropriate there.

"And I think in the classroom, there is an issue of course about teachers being able to address their students in a way where they can address them face to face. I think it is quite difficult in the classroom to be able to do that."

The Home Office minister Jeremy Browne earlier called for a national debate on whether the state should step in to prevent young women having the veil imposed on them.

That intervention was sparked by a row over the decision by Birmingham Metropolitan College to drop a ban on the wearing of full-face veils. Browne said he was "instinctively uneasy" about restricting religious freedoms, but he added there may be a case to act to protect girls who were too young to decide for themselves whether they wished to wear the veil or not.