A Canadian precedent could be set this week as the Supreme Court decides who pays to clean up the environmental mess left by a company when it goes broke.

The case has caught the interest of environmentalists, oil companies and governments, as well as banks and creditors across the country.

It focuses on Redwater Energy, a small Alberta oil and gas business that went bankrupt in 2015. Redwater had 80 oil and gas wells, most of which were inactive. The main lender, ATB Financial, and the receiver wanted to sell the company's 20 productive wells and use the proceeds to pay off debtors.

Alberta has about 150,000 abandoned and inactive wells. (CBC)

The Alberta Energy Regulator stepped in, arguing the money must first be spent on cleaning up the abandoned wells. The receiver refused, and the case went to court. Two courts have sided with the receiver, and on Thursday morning, the Supreme Court will release its decision.

The insolvency industry wants to be free of historic liabilities so they are better able to save troubled companies. However, the concern is billions of dollars of environmental cleanup costs could be dumped on taxpayers.

"Environmental issues are popular in insolvency across the board, not just in oil and gas, but in forestry, in mining, and in manufacturing," said David Bish, a Toronto-based partner and insolvency expert with law firm Torys.

Several provincial governments took part in the Supreme Court hearing last year because of the widespread impact the case could have. Politically, there is concern about the case, said Bish, if the court decides in favour of the insolvency industry.

"It's presented that people can pollute, they can make a lot of money while they pollute, and then when there's a downturn, they can walk away from those liabilities and not pay, and leave the public purse having to pick up the tab for that," said Bish.

ATB has said the case is about providing certainty to banks so if they lend money, they know where they rank in the list of creditors if a company fails.

Banks may stop lending

In an interview with CBC News last summer during his final days as CEO of ATB before retirement, Dave Mowat said he never expected this case to go to the Supreme Court because it's focused on bankruptcy law, not environmental law.

If lenders aren't given priority in bankruptcy cases, banks may stop lending to certain companies, such as smaller oil and gas businesses.

"It looks like we're this kind of environmental ogre, that we want to throw a bunch of wells back, but if you finance cars but all of a sudden somebody says you're not allowed to sell your cars, you'd stop financing cars," he said.

Banks say they should be protected because they are the ones taking the risk.

Hear an argument about why banks need certainty in lending:

The former CEO of ATB Financial spoke to CBC News in June 2018 about the Redwater case before his retirement. 1:37

Old wells polluting land

Many farmers and landowners are angry at the glacial pace of cleaning up old well sites, leaving them to worry about the effect on the land, water and their crops.

Now, Redwater adds another layer of uncertainty as the number of orphan wells balloons by the thousands.

"What's at stake is whether or not in Canada the law will be polluter pay or walk away," said Keith Wilson, a lawyer who has spent more than 30 years representing landowners, farmers and ranchers who have oil wells, pipelines and other infrastructure on their land.

He says the issue is "whether or not a company that leaves a large footprint on the environment is going to be held financially liable for cleaning up the environmental impacts or whether, when they get into financial trouble, they can cash in the good assets and simply walk away from the bad ones."

Landowners want — and deserve — to see their properties restored to their original condition, according to Daryl Bennett, a farmer who lives near Taber in southern Alberta and has become an advocate for landowners in the province.

"Where it may come back to bite is, how clean is your water? How clean is your food? How clean is your environment if these guys are allowed to walk away?"

Still, he's concerned no matter what happens on Thursday, the situation won't improve.

"Basically, Redwater is going to be determining who gets the right to screw the landowner," he said.

A decades-old problem

The dilemma of how to deal with orphan wells is nothing new for Alberta.

Oil drilling activity soared in the 1970s. However, when recession walloped the province in the 1980s, insolvent companies began abandoning problem wells at an alarming rate.

"Companies were walking away from assets that were no longer productive," said oilpatch historian David Finch.

In the early 1990s, the Orphan Well Association was created. The industry-backed fund was established to clean up abandoned wells in cases where there was no solvent entity able to do so.

But with the oil price collapse of 2014, the number of orphan wells has skyrocketed.

Finch said regardless of how the Supreme Court rules, it appears clear changes are necessary.

"This is a wake-up call for industry, for government and the public," he said.

"Even if it goes in Alberta's favour, it still points out very graphically at the very highest level of the law that our system is not adequate to deal with the liability issue as it is today."

See the details of Alberta's big environmental problem:

Barry Robinson says the Supreme Court decision is important, but regardless of the outcome, Alberta still has to cleanup thousands of oil oil and gas wells. 1:13

Alberta's ever-increasing cleanup bill

No matter the top court's decision, Alberta still has massive environmental problems on its hands. The province has about 150,000 inactive or abandoned wells.

"Most of these companies, by the time they go bankrupt they're empty shells. So, even if the environmental order comes first, there's likely not enough money in the trustee's hands to do the work," said Barry Robinson, a lawyer with Ecojustice, who has long been sounding the alarm about the orphan well problem in Alberta.

Too many of his clients are frustrated that old wells could be polluting their land, and there is no urgency by industries, the regulator or the government to clean them up.

"I wish I had a good answer when they come to me," said Robinson. "The longer a well sits inactive, the greater the risk of either contamination coming to the surface because the wellbore is not perfectly sealed or groundwater contamination, that sort of thing."