"Where is the crime if the newspaper publishes?" asked Mr Dawson. "If there is a crime, it has already happened."

Sandy Dawson, SC, for Fairfax said the action was misconceived and should be against the Commonwealth not the publisher, noting that the "horse has bolted" given the story was published at 6am on Friday and "has been read by thousands".

The story involved "wanton publication in breach of Commonwealth Law", in reporting details from an inquiry by the inspector-general into Mr Roberts-Smith while a member of the special forces. He said "there is no public interest in publishing material in breach of Commonwealth Law".

In court late on Friday, Arthur Moses, SC, for Mr Roberts-Smith suggested Fairfax Media’s reporters had committed a criminal offence by publishing confidential military information. He sought removal of the story from Fairfax websites and a ban on publishing the story on Saturday in print.

After the judgment, Mr Moses asked for the matter to be referred to the Australian Federal Police to see if there was "aiding and abetting" by journalists. Justice Bromwich said referrals from the Federal Court could only be made in the event of a determination by a court – and that would be a step too far.

Mr Roberts-Smith, who is one of three living recipients of the Victoria Cross for Australia, the nation’s highest military honour, issued an emphatic denial of the allegations, labelling them a "catalogue of lies, fabrications and misrepresentations".

He said early on Friday he would vigorously defend himself against the "malicious" claims.

“I do want to say today that I unequivocally deny any physical abuse of any woman at any time ever, and that I have not at any stage been interviewed by police about any purported complaint by any woman," Mr Roberts-Smith, now an executive at Channel Seven, said in a statement on Friday.

“I am deeply troubled that alleged evidence given on oath before the [Inspector-General of the Australian Defence Force] inquiry has been canvassed in the press and that Fairfax has allegedly accessed it. Not only is it illegal, it is unfair to people who haven’t given evidence and it has the potential to undermine the fairness of the inquiry."