A Marion County Circuit Court judge on Wednesday potentially blew a hole in the budget of the embattled Oregon Department of Energy.

Judge Tracy Prall ruled that the agency improperly collected millions of dollars from utilities and said ODOE must give the money back.

ODOE collects what's called an "energy supplier assessment" from utilities. In 2015, ten public utilities sued the agency, arguing it had failed comply with a law requiring it to explain to the utilities why they were being assessed and how the money collected, which totals about $6.5 million a year from all payers, would be used.

The judge's decision adds to a litany of woes for ODOE, which has been embroiled in a long-running controversy over the awarding of more than $1 billion in tax credits, a saga that recently included a guilty plea from a former agency employee for accepting numerous bribes while acting as the agency's liaison with buyers of the tax credits.

Some lawmakers have called for the agency to be abolished.

In her ruling, Judge Prall ordered ODOE to refund the energy supplier assessment, or ESA, for 2016 because it failed to provide a "full accounting" of how the money was to be used.

"ODOE's failure to provide the full accounting required by [law] deprived representatives of energy resource suppliers and other interested parties of information the legislature intended them to have so that they could fully and effectively participate in the legislative process," the judge wrote. "There is no remedy that would adequately address ODOE's failure other that setting aside the orders imposing the 2016 ESA."

Judge Prall also ruled that that the ESA is in fact a tax, a point of contention between utilities and the agency. That means that it cannot be increased without a three-fifths vote of the Legislature.

A lobbyist for the public utility plaintiffs celebrated the victory.

"Utility customers should receive value for payments they make to state agencies," said Danelle Romain, a lobbyist for the Oregon People's Utility District Association. "ODOE should be required to follow the procedures set out in statute, especially in this case where they personally negotiated and agreed-to the statutory language."

The agency has not yet decided how to proceed.

"We are aware of the ruling and considering next steps," says Rachel Wray, a spokeswoman for ODOE.