Michaelia Cash has lost a legal bid to avoid handing over documents relating to police raids on the Australian Workers’ Union.

In a decision on Wednesday, the federal court allowed a search for documents the union believes will show coordination between the employment minister, her office and the Registered Organisations Commission to support its case of alleged political interference.

On 25 October, Cash’s senior media adviser David De Garis resigned after Buzzfeed revealed he had tipped off media about the Australian federal police raid on the AWU headquarters.

The AWU has brought a federal court case challenging the validity of the AFP warrants and the legality of Cash’s referral to the Roc asking it to investigate $100,000 of donations to the progressive campaign group GetUp in 2005.

In October Cash told a Senate inquiry that De Garis said he had learned about the raids from a “media source”, the identity of which has never been established.

The AWU is seeking internal communications from August to October between Cash and her office and external communications with the Roc, Fair Work ombudsman, AFP, employment department and media relating to the donations and warrants.

Cash’s attempt to limit the period of discovery was rejected, although only communications with FWO officers who also worked for the Roc will have to be produced.

According to the FWO’s evidence to the Senate inquiry, Mark Lee, a FWO media adviser who worked for the Roc and was due to take a job in Cash’s office, knew at 12.30pm on 24 October that warrants had been sought.

Lee has maintained he had no communications with anyone outside the Roc about the raids until after they had started, effectively denying he is De Garis’s source.

In dealing with the subpoena on the FWO and Lee, Justice Mordy Bromberg said the union had a legitimate purpose in seeking to show a “close association between persons assisting the Roc and the minister and her office”, rejecting claims this amounted to a “fishing expedition”.

In a statement the AWU’s lawyer, Maurice Blackburn principal Josh Bornstein, said that since the case started in October “at every turn we have seen minister Cash, the Roc and others involved ... seek to thwart scrutiny of their role in the disgraceful raids on the AWU by federal police”.

“It has taken an order from the court to force their hand,” he said. “The court’s orders mean that we are moving closer to establishing the truth behind this investigation and the police raid.”

Bromberg noted FWO time estimates for production of documents had ballooned from “weeks” to “more than three months” to “on one of the estimates, nearly four years”.

The judge blasted the FWO for the inconsistency, saying “no attempt” had been made to explain it and concluding it had not undertaken a proper assessment of search times.

Internal communications in Cash’s office and those with the AFP, employment department and media will not have to be produced immediately.

Bromberg said that Cash had accepted these documents may show her purpose in referring the GetUp donation to the Roc, including whether she “sought to derive political advantage from the investigation and the execution of the warrants”.

Nevertheless he said the AWU could seek them after communications with the Roc were produced, noting that Cash was not a party to proceedings and should not be burdened with discovery until then.

The matter is listed for hearing on 22 January. The AFP has started an investigation into the leak.

• This article was amended on 20 December 2017 to remove the reference to Mark Lee having known about the raids. According to evidence in the federal court, the Fair Work Ombudsman told the Senate inquiry Lee was informed by the Roc at 12.30pm on 24 October that warrants had been sought.