RICHMOND, Va. (AP) — The Virginia Supreme Court issued a ruling Thursday upholding a state law that has blocked millions of dollars in refunds to electric customers.

The court ruled 6-1 that the General Assembly is within its constitutional authority to temporarily suspend state regulators' ability to adjust a portion of electric rates.

The 2015 law, which was shepherded through the General Assembly by Dominion Energy and passed with broad bipartisan support, was touted by proponents as a way to prevent rate spikes due to uncertainty around carbon regulations.

"We are pleased the court affirmed the constitutional and statutory authority of the General Assembly to make policy decisions for the commonwealth," said Dominion spokesman David Botkins.

The law shields companies from having to give refunds or lower their rates for several years, even if regulators have found their base rates — which make up a majority of customers' bills — are too high. During the same period, it also bars utilities from raising their base rates if they aren't enough to cover their costs.

The legal challenge was brought by a group of large industrial electric customers and advocates for the poor. They and other critics of the law said it guts the State Corporation Commission, which is tasked with setting electric rates and was established more than a century ago as a bulwark against the politically powerful railroad companies. Dominion, the largest corporate donor to state lawmakers, is now the top power broker at the Capitol.

There is little dispute the law has helped the utilities' profits. Using Dominion's own figures, state regulators calculated in a recent report that the company's customers would be due about a $130 million refund on bills paid in 2015 and 2016. Appalachian Power, the state's other large regulated monopoly, had overearnings of more than $20 million in 2016, according to report.

The investment bank Goldman Sachs issued a report in June saying that the legal challenge to the law presented a "downside risk" to Dominion's bottom line.

But Dominion has said its rates are fair and the law is needed because of the continued risk that pricey new regulations will be implemented for carbon-emitting power plants. Gov. Terry McAuliffe announced plans earlier this year to regulate emissions from power plants, saying Virginia "cannot afford to sit idly by" as President Donald Trump rolls back his predecessor's efforts to battle climate change.

Democratic state Sen. Chap Petersen, a critic of the 2015 law, said the court's ruling was disappointing. He plans to try and overturn the law during next year's legislative session.

"There's a lot more public scrutiny on these laws and on these votes," Petersen said. "Now people are seeing exactly what they voted on in 2015."