Amber Heard will be allowed to give evidence about alleged sexual violence at the hands of her ex-husband Johnny Depp behind closed doors, after lawyers successfully argued she should not be forced to make certain claims in front of the media.

Heard is a key witness in a libel case in which Depp is suing the Sun newspaper and its associate editor, Dan Wootton, over an article that referred to the Pirates of the Caribbean star as a “wife-beater”.

Depp’s lawyers claimed Heard has been using “salacious” claims to draw attention to the case and questioned her desire to give parts of her evidence without journalists in the room.

“She hasn’t sought anonymity, quite the opposite,” argued David Sherborne, acting for Depp. He said Heard’s accusations would be proved to be “outright lies” and said they would need to be scrutinised “very carefully”.

He argued Heard’s decision to identify as a prominent supporter of the #MeToo movement and publicly take part in United Nations events about sexual violence meant she could not later request privacy when giving evidence.

“Is it really the case that she is so distressed that it is necessary for the principle of open justice to be overturned?” asked Sherborne.

He later added: “He [Depp] is in the worst of all worlds, where it is said very publicly that he committed acts of sexual violence but the details of them will be heard behind closed doors.”

Mr Justice Nicol, having heard the arguments from Depp’s legal team and Adam Wolanski QC for NGN, who made the case on Heard’s behalf, ruled the nature of the “sexual violence” claims being made by Heard meant she should be allowed to give evidence behind closed doors. “The matters which will be dealt with in private are of a different order to what has been made public so far. I am satisfied that there is good reason to treat them differently.”

Heard previously obtained a domestic violence restraining order against Depp in 2016, shortly after she filed for divorce. In a separate case, Depp is personally suing Heard for libel in the US over an opinion piece she wrote for the Washington Post in 2018 about being a public survivor of abuse, which did not specifically mention Depp.

The British libel trial had been expected to start at the end of March and was expected to feature a string of celebrity witnesses. However, it was adjourned two weeks ago after the judge concluded it was impossible to call on witnesses to travel from around the world due to the coronavirus pandemic.

One key issue is the circumstances in which Depp lost the tip of one of his fingers while filming the fifth Pirates of the Caribbean film, around the same time the duo were at the centre of a storm over bringing their dogs to Australia. Depp says Heard inflicted the injury on him, while Heard claims Depp did it to himself while on a three-day booze and drugs bender.

The hearing on Wednesday morning took place on a Skype conference call, with the judge, journalists and lawyers dialling from as far afield as Australia to watch a sometimes unusual hearing, which was occasionally interrupted by patchy internet connections.

Leading lawyers made impassioned pleas over their webcams, while the spare bedrooms of leading legal figures were on display for all to see. When the hearing entered a private session, the judge ordered journalists covering the case to hang up the Skype call, with a clerk checking that no reporters remained on the conference call.

A spokesperson for Heard welcomed the ruling: “We welcome Mr Justice Nicol’s decision to allow evidence relating to ‘sexual violence’ to be heard in closed court. There is simply no reason for such sensitive evidence to be exposed to the world’s press.

“We are pleased that the court made this order despite Depp’s troubling argument that Amber should not benefit from the right to privacy in relation to sexual violence, because of her public association with the #MeToo movement and her advocacy for victims of sexual violence at the United Nations.”

The trial is scheduled to take place in July.

• This article was amended on 9 April 2020 to remove references to David Sherborne being a Queen’s Counsel. He has not been appointed to this position.