The Australian Federal Police (AFP) acted unlawfully when they raided the Canberra headquarters of the Construction, Mining, Forestry, and Energy Union (CFMEU) in August, the ACT Supreme Court has found.

The union sued the AFP over its conduct during a raid of its Dickson offices in late August, in which detectives attached to the Royal Commission into Trade Union Governance and Corruption seized materials.

In court, union lawyers said much of the material seized during the search, conducted under two separate warrants, was private and unrelated to the royal commission's investigations.

It was also claimed officers began searching the premises without properly producing a warrant, and would not allow union officials access to certain rooms during the raid.

Today, Supreme Court Justice Richard Resfshauge found that the conditions of the search warrant had not been observed.

He ordered that the AFP return most of the seized materials, and destroy all copies.

Police will be able to examine some of what was taken under one of the warrants, but the court warned it would likely be challenged if used as evidence in court.

The AFP was also ordered to pay costs.

CFMEU praises 'fantastic result'

ACT CFMEU secretary Dean Hall said the union respected police and had always been prepared to hand over lawfully requested materials.

"The Australian Federal Police officers who have been attached to the trade union royal commission taskforce have clearly broken the law," he said.

"They didn't follow their own procedures and the procedures set down by the court.

"The CFMEU is prepared ... and always will be prepared to follow orders, any notice to produce, and any lawful request for legal documents."

Mr Hall said it was "distressing" to see that the AFP had fought the case, and that it would also pay the legal costs of the CFMEU.

"That money could [have been] used to tackle domestic violence, to tackle the scourge of the ice epidemic in our community," he said.

"But instead, unfortunately that money was used to attack workers and the union."

The ruling is the second setback to the trade union royal commission's investigations in Canberra, after a blackmail charge against CFMEU organiser John Lomax was dropped.

The royal commission would not comment on the outcome of the case.