Energy companies must fulfil their environmental obligations before paying back creditors in the case of insolvency or bankruptcy, Canada's Supreme Court has ruled.

The top court's ruling released Thursday overturns two lower court decisions that said bankruptcy law has paramountcy over provincial environmental responsibilities in the case of Redwater Energy, which became insolvent in 2015. That meant energy companies could first pay back creditors before cleaning up old wells. In practical terms, that means energy companies could walk away from old oil and gas wells, leaving them someone else's responsibility.

The top court ruled 5-2 to overturn the earlier ruling. In doing that, it said bankruptcy is not a licence to ignore environmental regulations, and there is no inherent conflict between federal bankruptcy laws and provincial environmental regulations.

Okotoks, Alta.-based Redwater Energy owned a stake in 17 producing oil and natural gas wells, as well as many more inactive wells. At the time of its insolvency, the company owed its bank, ATB Financial, just over $5 million.

After Redwater became insolvent in 2015, its bankruptcy trustee wanted to sell the firm's valuable wells to repay debt to its bankers and walk away from the non-producing wells — leaving them to Alberta's Orphan Well Association (OWA) to cleanup. The OWA is funded by the energy industry.

This Redwater Energy site in Northern Alberta is under the control of the Orphan Well Association. After the Supreme Court decision, there will now be funds to clean up the site. (CBC)

Can't walk away from old wells

When the Alberta Energy Regulator (AER) said Redwater could not ignore its environmental responsibilities, the bankruptcy trustee in this case, Grant Thornton, along with Redwater's lender, ATB Financial, decided to challenge the law.​

In its decision brief, the top court said the trustee "couldn't walk away from the disowned sites. It said that the BIA [Bankruptcy and Insolvency Act] was meant to protect trustees from having to pay for a bankrupt estate's environmental claims with its own money. It didn't mean Redwater's estate could avoid its environmental obligations."

ATB Financial's chief executive, Curtis Stange, said he was not disappointed with the Supreme Court decision, but doesn't regret challenging the law in the first place.

"It was important for us to get clarity on what the interpretation of the law was, to ensure that we could have the right approach in balancing the environment and the economics," said Stange in an interview with CBC News.

"ATB will will continue to support the energy industry. We think it's the fabric and the backbone of Alberta, and we'll continue to support that industry, will continue to support our customers, and we will just take some time to get to know and understand the implications of the decision."

Alberta government reacts to SCC Redwater decision 3:29

Industry happy with decision

Both large and small energy companies are happy with the decision. The Canadian Association of Petroleum Producers says it believes the judgment restores the balance between environmental obligations and creditor interests.

Smaller companies, which are more likely to have trouble getting financing from banks, are represented by Explorers and Producers of Canada (EPAC).

EPAC's president, Tristan Goodman, said the ruling came as a surprise, but shouldn't cause too many problems for the junior sector.

"I think generally for most of our members it's not going to be an issue. Often what you'll find when you speak to banks and when you talk to investment houses [is] they've already built in some component of this."

'Concept of polluter pays is alive'

The Redwater case has been watched closely across the country. Ontario, British Columbia and Saskatchewan all intervened, supporting the Alberta Energy Regulator's position that the polluter must pay for cleanup before creditors are paid back loans.

Alberta has been dealing with a tsunami of orphaned oil and gas wells in the past five years. In 2014, the Orphan Well Association listed fewer than 200 wells to be plugged . The most recent numbers show there are 3,127 wells that need to be plugged or abandoned, and a further 1,553 sites that have been abandoned but still need to be reclaimed.

"This is good news for landowners, taxpayers and the environment," said Keith Wilson, a lawyer who represents landowners with oil and natural gas wells on their properties. Among his clients are those with wells sitting idle on their land for decades.

"The concept of polluter pays is alive and well in Canada."

Watch Alberta's energy minister comment on the Supreme Court decision:

The president of EPAC says the majority of companies are taking care of their old oil and gas wells. 0:46

Energy minister praises decision

"The court's decision means that Albertans are better protected from the few irresponsible producers and operators in the system," said Marg McCuaig-Boyd, Alberta's energy minister.

"It's good news that you have to clean up after yourselves."

McCuaig-Boyd was pressed on whether Alberta will implement timelines on the cleanup of inactive wells. At the end of 2018, nearly 90,000 wells in the province were sitting idle. Under current rules, they can continue to sit idle so long as lease payments are made to the landowner.

"We are looking at hard timelines and targets for abandoning and closing wells," said McCuaig-Boyd. "We do need to have tight timelines."

Alberta still has a problem

The orphan well inventory has risen rapidly in the past several years in part because of the initial Redwater lower court decision in 2016, said Fenner Stewart, an energy law expert with the University of Calgary.

"When the lower court ruled against the Alberta Energy Regulator, a hole was created in the regulatory regime, and the regulator could no longer stop receivers from selling valuable wells and walking away from the rest," Stewart said. "Today, the Supreme Court of Canada has closed that hole, but creditors have cleared much of the dead weight in the interim.

"The bill is huge, and although the Canadian Association of Petroleum Producers is ultimately responsible to pay it, it is difficult to imagine that average Albertans will not end up picking up some of the debt — one way or another."