Supreme Court will decide who gets paid first – creditors, or the cleanup efforts on orphaned wells.

An Alberta legal battle over whether creditors take priority over the cleanup of old oil wells has landed at the Supreme Court of Canada — with seven justices now tasked with a decision that could have implications for industry and the environment across the country.

The nation's highest court last week heard the contentious case, centred on the failure of Redwater Energy, a junior oil and gas company that slipped into receivership in 2015 in the wake of the oil price collapse.

Redwater's receiver wanted to sell the company's few good wells to pay off the company's debts, but the Alberta Energy Regulator (AER) said such proceeds should help pay to clean up after Redwater's inactive wells as required by provincial regulations.

Two lower court rulings have sided with Redwater's receiver.

Now the Supreme Court will determine if the country's bankruptcy laws are in conflict with Alberta's regulatory regime — and if those federal laws are paramount to the province's environmental rules.

The AER and the Orphan Well Association (OWA), an industry-funded group that cleans up such wells, say billions of dollars in future cleanup costs and Alberta's right to decide how it manages its own resources are both potentially at stake.

"It's not just an issue for the oil and gas industry in Alberta but for all of Canada and all of the resource sectors," Lars De Pauw, executive director of the OWA, told The Canadian Press after last week’s hearing.

Insolvency professionals and banks have long argued they should not be held liable for an energy company's activity, warning that reversing the lower court rulings could lead to more orphan wells and potentially decrease the amount of financing available to the oil and gas industry.

"The bankers' association supports the 'polluter-pays' concept," lawyer Howard Gorman, speaking for the Canadian Bankers' Association in support of Redwater's receiver, told the court. "'Polluter pays' doesn't mean polluter's lender pays… It means what it says: the polluter pays."

The case has seized the attention of provinces, environmentalists and the energy industry. They believe the ruling could affect the state of co-operative federalism. Saskatchewan, British Columbia and Ontario, in submissions to the court, said that federal bankruptcy laws do not allow a bankrupt company to avoid its environmental remediation obligations.

The Supreme Court's decision is expected in spring or summer.