Search warrants issued to raid the homes and offices of four former partners at KPMG in Belfast were unlawful, the High Court has ruled.
Judges indentified faults in statements used to support applications for permission to trawl their premises.
The raids were part of an investigation into suspected tax evasion.
However, judges rejected separate claims that HM Revenue and Customs provided misleading information.
However, a high court judge rejected this claim and said: "The basis upon which the above argument is advanced is highly speculative and based on a range of inferences drawn by the applicants."
A further hearing to determine remedies in the case may now take place early in 2018.
The four executives challenged to the legality of the process to obtain warrants to search their premises.
At the time, KPMG said it was co-operating with the inquiry and had placed them on "administrative leave".
KPMG stressed the investigation related solely to the executives' personal affairs and was unrelated to the company's business or its clients.
Instead, HMRC's inquiry was focused on the tax affairs of a separate enterprise in which the the four accountants were partners - Focused Finance Partnership.
Their lawyers stressed that they completely rejected any allegations of involvement in tax evasion.
It was argued that HMRC should have considered less intrusive steps in an attempt to quell any suspicions.
No attempt was made to put direct questions to the accountants about issues of concern to HMRC, according to the men's lawyers.
The authority allegedly saw the case as a chance to detain four high-profile men, the court was told.
Counsel also claimed judges who granted the warrants were given misleading information about the extent of the four accountants' co-operation with inquiries.
Those contentions were rejected, along with an assertion that the decisions to seek the warrants were unreasonable.
The judge said: "Considering all the information presented in the statements of complaints we find that the judges were justified in finding that the statutory grounds for issuing a search warrant had been satisfied in each case."
However, he identified legal defects in the documents, including a failure to properly identify the articles being searched for.
"We consider that the warrants issued in the present case were unlawful," he confirmed.
Outside court, the four accountants' solicitor insisted they had fully co-operated with HMRC.
"The decision to grant these warrants has had a devastating impact on each of my clients, both personally and professionally," he said.
"We welcome the decision by the court to declare these warrants unlawful."