A federal appeals court on Wednesday upheld a ruling that Minnesota's 2007 clean energy law illegally regulates out-of-state utilities, the latest and perhaps final chapter in a five-year legal battle between the state and North Dakota.

The appellate court decision is a win for the state of North Dakota and its utility and coal interests, which argue that the Minnesota law hampered their ability to sell electricity from coal-fired power plants and build new coal generators.

The Minnesota law, dubbed the Next Generation Energy Act, effectively aims at coal by restricting electricity imports from power plants that increase greenhouse gases.

In April 2014, U.S. District Court Judge Susan Richard Nelson in Minnesota enjoined the state from enforcing key sections of the law, calling it "extraterritorial regulation." A three-judge panel of the U.S. Court of Appeals for the Eighth Circuit concurred with Nelson's ruling, though each wrote a separate opinion.

Wayne Stenehjem, North Dakota's attorney general who sued Minnesota in 2011, said he was "extremely pleased" by Wednesday's decision. "Your governor," he said referring to Minnesota Gov. Mark Dayton, "said from the beginning it was a frivolous lawsuit. Now, we have gotten favorable rulings from two courts."

Dayton, in a press statement, said he "strongly disagreed" with the appeals court's decision.

"The state statute does not prevent anyone from building and operating a new power generating facility, whose emissions will affect Minnesota's air quality. It only requires that those new emissions be offset by the same or greater reduction in emissions from other plants."

Dayton said he will review the ruling with Minnesota Attorney General Lori Swanson to consider how to proceed.

The state has two options. It can petition the Eighth Circuit Court of Appeals for an "en banc" hearing, meaning all of the court's judges — they number more than a dozen — would review the case. En banc petitions aren't easy to get accepted.

Even more difficult would be an appeal directly to the U.S. Supreme Court.

"It's unlikely the Supreme Court takes this case," said Ari Peskoe, an energy fellow at Harvard Law School's Environmental Policy Initiative.

Still, Minnesota should be able to make solid legal arguments in any appeal, Peskoe said, adding that the Eighth Circuit court ruling surprised him.

One appellate judge, James Loken, found that the Minnesota law violated the U.S. Constitution's Commerce Clause because it regulated transactions taking place "wholly outside" of Minnesota. The state was essentially imposing its own policy on a neighboring state.

Another judge, Diana Murphy, disagreed with Loken, saying instead that the Minnesota law errantly "bans wholesale sales of electric energy in interstate commerce." The Federal Power Act gives exclusive jurisdiction to the federal government — not states — to regulate the interstate wholesaling of electricity.

The third judge, Steven Colloton, concurred with Murphy on the wholesale power issue, but added that the Minnesota law also conflicts with the federal Clean Air Act.

The law permits dirtier out-of-state power plants to sell into Minnesota as long as they reduce greenhouse gas emissions somewhere in their generating systems. Such a requirement encroaches on North Dakota's authority to govern emissions within its own borders, running counter to the Clean Air Act, Colloton wrote.

The court's decision covers only a part of Minnesota's Next Generation Energy Act and doesn't affect the law's requirement that Minnesota utilities get 25 percent to 30 percent of their electricity from renewable sources such as wind and solar.

While the court's decision is a setback for environmental groups that have sided with Minnesota, coal-generated power has been in a big decline since 2007 when the state law was passed. Utilities have increasingly turned to cheaper, cleaner natural gas-fired generators, while also adding sources of wind and solar power.

"Maybe we needed the law in 2007," said Michael Noble, executive director of Fresh Energy, a St. Paul clean energy advocacy group that filed a friend of the court brief on behalf of Minnesota. "But in 2016, the three largest [U.S.] coal companies have gone bankrupt, and coal [fueled] power plants are closing right and left."

Mike Hughlett • 612-673-7003