A Montana judge has sided with the solar developers in a lawsuit faulting NorthWestern Energy and the Public Service Commission for thwarting small renewable energy projects.

District Judge James Manley faulted the PSC for deliberately creating contract and pricing terms that made solar energy projects uneconomical. State regulators now have 20 days to come up with a fair pricing scheme and to restore solar energy contracts to 25 years.

Commissioners knew their actions would kill solar development, Manley said. In a 2017 conversation recorded by a hot mic, Commissioner Bob Lake acknowledged to PSC staff that cuts made that morning to rates and contracts offered to small renewable energy projects were deep enough to kill future development.

The fight over solar energy started in the spring 2016, when the state’s largest monopoly utility, NorthWestern Energy, persuaded the PSC to suspend a 50-year-old federal law requiring utilities to buy power from alternative energy facilities, complete with rates and contract lengths set by states.

NorthWestern complained that it was overrun by small solar projects seeking to capitalize on the state's guaranteed rate of $66 a megawatt hour. After the PSC suspended the federal rule, the number of small Montana solar projects crashed from 100 to fewer than a dozen.

Federal regulators later faulted the PSC for letting NorthWestern dictate its own terms.

It was unclear Thursday how many solar developers had been chased off by the now three-year-old solar energy dispute. One of the plaintiffs, Cypress Creek Renewables, had plans for several qualifying facilities each 3 megawatts in size. Projects of that scale were assured a price of $66 a megawatt hour before the PSC suspended the Public Utility Regulatory Policies Act in 2016. The commission then reset that rate to $31, a price the court ruled violated the law.

For NorthWestern, the ruling means the utility will have to start offering 25-year contracts to solar developers at a price reset by the PSC. The company wasn’t sure Thursday whether it would live with Manley’s order or appeal.

“We are evaluating the right course of action to take next for this case,” said Jo Dee Black, NorthWestern spokeswoman.

In one favorable part of the ruling for NorthWestern, the judge concluded the PSC could not commit the utility to the same contract lengths imposed on third-party energy developers.

Attorneys for the solar developers said the lawsuit stemmed from NorthWestern wanting to kill energy development by third parties. There’s less money to be made buying power from the third party than there is in owning the generating asset.

“It’s really NorthWestern that’s clinging to a business model that maximizes profits to the utility. It’s fundamentally threatened by the independent production of power, be it dirty power or clean power,” said Jenny Harbine, attorney for EarthJustice.

A second potential beneficiary of Manley’s ruling is MT Sun, a 480-acre solar farm to be developed west of Logan International Airport in Billings. The $110 million project was rendered unworkable by the uneconomical rates established by the PSC, said attorney Michael Uda. A longer contract, combined with a power purchase price equal to NorthWestern’s avoidable cost of a similar utility-owned project, could make a Billings solar farm economical.

The PSC had attempted to shorten energy contracts from 25 years to 15 after some long-term NorthWestern price agreements left customers paying much higher rates for energy than current market prices.