Anyone who films a partner during sex without their consent is committing the criminal offence of voyeurism, the court of appeal has ruled in a case that may affect the Crown Prosecution Service’s apparent reluctance to bring charges.

The ruling by three judges came at the end of an unsuccessful appeal by a man convicted of filming himself having sex with prostitutes. His lawyers argued that the voyeurism law allowed him to do so since even a bedroom is not a private place if he was there legitimately.

In a highly unusual development in a criminal case, the court allowed someone not directly involved in events to intervene in the hearing to develop arguments that consent should be the primary issue when considering cases under the 2003 Sexual Offences Act.

The CPS said afterwards it was urgently reviewing the decision and would assess whether to continue resisting a judicial review claim brought by Emily Hunt, the woman who intervened in the hearing and who has criticised prosecutors for refusing to bring charges after she was filmed naked in a hotel bedroom by a man without her consent.

The unanimous decision by Lord Justice Fulford, Mrs Justice Cheema-Grubb and Mrs Justice Foster came at the end of an application by Tony Richards, 39, of Cardiff, to have two voyeurism charges under section 67 of the Sexual Offences Act dismissed on the grounds that he had committed no crime.

Jon Rees QC, for Richards, told the court that even though the two women may not have consented to being filmed, if Richards was entitled to be in their bedrooms they could not have a reasonable expectation to privacy.

When parliament drew up the legislation, it did not define the rules simply as a lack of consent, Rees said. “Lack of consent is not sufficient [to make it a criminal offence] where the place where it occurs is shared with another [person].

“The test is whether the complainant had a reasonable expectation of privacy. It may be a betrayal of trust to record a person having sex with you but it’s not an illegal act.”

John Price QC, for the CPS, said that what mattered was the “nature of the observation”. Surely any consenting partner would have a “reasonable expectation to not being filmed so as to enable another person to view it afterwards or make it available to others?”

Jude Bunting, the barrister representing Hunt, said she was bringing a judicial review claim of the CPS’s refusal to take action over an incident in 2015 when she was allegedly raped and filmed by a man as she lay unclothed asleep on a hotel bed.

Hunt has been told by the CPS that they will not pursue the rape charge and also that they will not consider a voyeurism offence. She is challenging their decision not to act over the filming and says they have resisted action on similar grounds to those advanced on behalf of Richards.

In a written submission to the court, Bunting said: “Having sex with someone in a private room shut off from public display or attention is ‘doing a private act’ … Observing someone in a private room is temporary. A video recording could be shown to a third party. It represents complete loss of autonomy over a person’s personal image and integrity.”

Dismissing Richard’s appeal against the conviction, Lord Justice Fulford said: “A defendant can be guilty of an offence of voyeurism in relation [to having sex] even when he is a participant … section 67 of the act which protects individuals against the recording of any person involved in a private act is not limited to protecting the complainant from someone not present during the act.”

Speaking after the decision outside the court, Hunt told the Guardian: “It’s great that people should have an expectation of privacy. What upset me so much was the voyeurism aspect of my case. When I went to the CPS in 2016, I was told that it was not illegal to video someone naked without their consent if it’s in the same a room [where they are entitled to be present].

“They say if you consent to being seen, you consent to being videoed. I know of at least one other case of someone who contacted the CPS and was told the same thing. The CPS has fought every step of the way not to bring a prosecution [in my case].” Hunt said she hoped CPS lawyers would now change their decision following the appeal court ruling.

Rees asked the court for permission to appeal to the supreme court on a point of law.

Emily Hunt was supported in her legal campaign by the Centre for Women’s Justice. Later on Tuesday, she said she had been told by her lawyers that the CPS was no longer resisting her judicial review claim and was now re-examining its decision not to prosecute.

A CPS spokesperson said: “What constitutes a ‘private act’ for the purposes of the offence of voyeurism had never been conclusively defined by a higher court until today.

“The CPS does not make or decide the law; that is the remit of parliament and the courts respectively. Now that this new authoritative judgment has clarified this point of law, the CPS will review its position in the judicial review brought by Emily Hunt.”

Kate Ellis, a solicitor acting for Hunt at the Centre for Women’s Justice, said: “We welcome today’s decision and trust that the CPS, who have fought this for so long, will finally bring this man to justice.”

Harriet Wistrich, the director of the Centre for Women’s Justice, said: “We would like to know why the CPS chose to argue opposite points in two separate cases. As a publicly funded body, they have a duty to act consistently and in the public interest.

“In the context of significant reductions in the number of sexual offences prosecuted by the CPS, it is disappointing that they put limited resources into fighting cases for the sake of an argument where complainants have suffered significant trauma and deserve their cases to be put before a jury”.