A federal judge ruled Tuesday that prosecutors unconstitutionally pressured the accounting firm KPMG into cutting off legal fees for 16 former employees charged with setting up illegal tax shelters.

In a harshly worded opinion, U.S. District Judge Lewis A. Kaplan offered strong criticism of a Justice Department policy dating from at least 1999 that considered companies to be "uncooperative" if they continued to pay the legal bills of executives accused of wrongdoing.

In the past few years, companies trying to avoid being indicted have frequently sought to show their willingness to cooperate with the government by cutting off payments to workers at the center of scandal.

KPMG took such a step in 2004 in regards to employees accused in what the government has described as the largest criminal tax case ever, in which the affluent dodged $2.5 billion in U.S. taxes.

Kaplan said in his ruling Tuesday that he is convinced that KPMG, which had previously agreed to pay the legal bills of its accused workers, had taken the step because of government pressure.

"KPMG refused to pay because the government held the proverbial gun to its head. Had that pressure not been brought to bear, KPMG would have paid these defendant's legal expenses," Kaplan wrote.

"Those who commit crimes — regardless of whether they wear white or blue collars — must be brought to justice. The government, however, has let its zeal get in the way of its judgment. It has violated the Constitution it is sworn to defend."

Kaplan declined, however, to punish prosecutors for their misdeeds by dismissing the charges against the 16, and it was unclear what would be done in the end to remedy their situation.

The judge suggested that the defendants sue KPMG for breaching the previous agreement to pay their legal bills, and ordered a civil docket opened to ease their path if they wish to do so.

The U.S. attorney's office for Manhattan had insisted throughout the case that it applied no pressure on KPMG, and that the company was free to do what it wished in terms of paying for the legal defense of former executives.

Kaplan said he would hold the government to that promise.

The dispute centered on a Justice Department policy memorandum that suggested that companies that were uncooperative in a criminal probe could themselves be indicted, a step that often means death for a troubled firm.

The memorandum said one factor to consider, when determining a company's level of cooperation, was whether they had continued to pay the legal bills of accused workers.

KPMG LLP has signed a deal admitting its role in the tax shelter scheme. It avoided criminal prosecution as it agreed to continue cooperating and to pay a $456 million fine, including $128 million in forfeited fees from sales of the shelters.

Prosecutors have accused the former employees of assisting wealthy clients evade billions of dollars in capital-gains and income taxes with elaborate tax shelter schemes and concealing them from the IRS.