It was nearly a year ago when Allan MacRae got a call from a friend and former colleague warning of trouble brewing at a small Alberta natural gas producer.

Lexin Resources wasn't on the radar of most Albertans last spring, but it was under scrutiny from the Alberta Energy Regulator (AER), and some of its own employees had become concerned about safety.

Lexin operated more than 1,300 natural gas wells in the province and the 30-year-old Mazeppa Processing Plant south of Calgary, which processed sour gas — a natural gas that contains hydrogen sulphide and is deadly to humans and animals, even in small concentrations.

It needs to be managed very carefully.

And that's why what MacRae learned shocked him. His contact at Lexin said that because of financial difficulties, the company wasn't maintaining the plant as well as it could and didn't have access to many of its sour gas wells because it hadn't made lease payments to landowners. More importantly, his source was concerned the company wasn't doing enough to maintain the pipelines that carried sour gas to the plant.

MacRae, a professional engineer who'd been the General Manager of Engineering for Canadian Occidental when it owned the Mazeppa Plant in the 1990s, did his own research and came to an alarming conclusion.

"Worst-case scenario would look like this," MacRae told CBC News. "You have a major [pipeline] blowout with sour gas with a southeasterly or easterly wind and it carries over a number of southeast and east Calgary subdivisions.

"Nothing from earthworms and up would survive."

A Lexin Resources well site in southern Alberta. Many of the company's natural gas wells will need to be reclaimed and others will be sold after the province's regulator forced the firm into receivership back in March. (Tracy Johnson/CBC)

MacRae wrote to the AER about his concerns in late May. The regulator had been monitoring Lexin for months at that point, and in mid-June it ordered that the pipeline system be shut-in until repairs were done. About six weeks later, Lexin told the AER it could no longer respond to an emergency at Mazeppa and that the sour gas leak monitoring system wasn't working. Days later, the regulator ordered the plant to be shut down.

That intensified a series of disputes between the company and the regulator that led to the AER ultimately suspending Lexin's operations entirely this past February and taking the unprecedented step of forcing the company into receivership so that its assets could be sold off to pay to clean up its financial and environmental mess.

The Mazeppa plant and the sour gas wells are now under the control of the AER. The wells, pipelines and plant have been safely suspended, so the risk has been abated. But the question remains as to how much risk were Albertans in the southern part of the province facing in late 2015 and 2016?

Behind the scenes at Lexin

For the first time, MacRae's original source at Lexin, a former executive, has agreed to talk to media about what he saw as the company unravelled.

CBC News has agreed not to use his real name because he claims he's still owed money from his time at the company and is concerned about legal repercussions. He will be referred to here as Peter Jones.

CBC News has also spoken to other former managers at the company, along with employees, landowners and mineral rights holders who had dealings with Lexin.

Jones said that in the fall of 2015, a farmer called the plant to report what he thought was a sour gas leak.

"A sour gas leak is extremely dangerous, the stuff can kill you in a heartbeat," Jones said. "One or two per cent [hydrogen sulphide] will kill you. We were dealing with sour gas up to 40 per cent."

Jones said the company fixed the leak and then conducted an interior inspection of the pipeline system to find other spots where the metal may have corroded.

The Mazeppa Gas Plant is now under the control of the Alberta Energy Regulator. (Caroline Wagner/CBC)

Another former Lexin executive told CBC News the Mazeppa plant was in reasonably good shape at that time, having recently gone through what's called a maintenance turnaround, where the plant is taken off-line for a refresh. But the pipeline system was a concern, especially because of its proximity to hundreds of landowners, not to mention Calgary.

After the pipeline inspection was complete, staff at the plant suggested anti-corrosive chemicals be injected into the pipeline system to ward off further corrosion. According to sources, Lexin's leadership didn't follow that recommendation because of the cost.

Lexin's response

In a memo to CBC News, Michael Smith, a director at Lexin, said the inspection of the pipelines in October 2015 found several areas where there was corrosion. He said the main north-south supply line, which runs along Alberta's Highway 2, was subsequently repaired.

Smith said lateral pipelines, which feed the main line, were assessed and shut in, until the company could decide if it was worth fixing them.

Smith said the company looked at the risk, the repair costs of the pipelines and the production losses from the gas fields that were feeding the lateral pipeline system. He said the high cost of the anti-corrosion chemicals was a key factor in deciding what to do with the pipelines, but not the main consideration.

But Lexin's pipeline problems weren't finished.

There would be another gas leak in April 2016, which the AER described as medium consequence, meaning it could have a moderate impact on people and wildlife.

After the leak was reported to the AER, the regulator directed Lexin to shut down the main north-south pipeline until repair digs at multiple sites could be completed. The pipeline system was never reopened.

Keeping Mazeppa safe

Workers at the plant said 2016 was a challenging year for them.

Larry Nagle started working at Mazeppa in 1986 and retired after it was shut down by the AER.

"We were limping along, in some cases, which is not a good situation with a sour gas plant," he said. "You make sure that everything is operating in a proper way."

He offered the following example to highlight just how bad the company's financial situation had become: "They quit buying potable water for the plant in the spring of 2016. The company that was supplying water said, 'We're not bringing any more water because you haven't paid us.'"

Nagle started work at the plant more than 30 years ago. 0:34

In addition to concerns about working conditions, the union representing Mazeppa workers contacted the AER with a list of problems at the plant, including widespread corrosion and Lexin's refusal to test contaminated water in its ponds.

Nagle was one of only a few employees left at the plant in the spring and summer of 2016. He stayed on until late July, just before Lexin wrote to the AER saying it could no longer be responsible for Mazeppa.

"We were basically security guards, but we were only one man per shift," he said. "That is not a safe way to run anything. Anything can happen when you are walking around. You could fall, trip and there is no one to help you."

Lexin and the AER

Lexin and the AER are currently fighting in court over unpaid fees and the regulator's move to force Lexin into receivership back in March. Lexin is appealing the receivership order and largely blames the regulator for its problems.

Many of the court documents are very technical, but they do show the AER's growing frustration with Lexin.

For example, the regulator lists all the safety orders and directions it issued to the company beginning in February 2016, including a notice of non-compliance for its failure to install a dilution gas meter at a sour gas facility.

It also ordered Lexin to clean up a hydrocarbon spill at the Mazeppa plant, and to prove that it still had access to some of its wells after not paying surface leases. The regulator told CBC News it made 276 inspections at Lexin sites in 2016.

In his memo to CBC News, Smith said "we are convinced that no pipeline was operated in unsafe condition. The monitoring systems were in place and backed up by increased frequency operator inspections."

Smith said pipelines that were identified as a risk were de-pressurized and purged to be put in a safe state.

In July 2016, Lexin wrote to the AER saying that because it had laid off nearly all its staff, it could no longer respond to an emergency at the plant or its related infrastructure.

In letters to the AER in January 2017, Lexin said it wouldn't be able to provide health and safety measures for its sour gas wells after February 15, and that it believed the situation created serious health and safety concerns for all concerned.

On February 14, the AER suspended Lexin's operations, in March the company was forced into receivership.

A mess to clean up

The company may have been shut down but its problems remain.

Many of Lexin's natural gas wells will need to be reclaimed, others will be sold. They are now the responsibility of the Orphan Well Association, which is funded by the energy industry but has also received public money in the past.

The list of creditors is long and there are also questions about whether the Mazeppa plant will be sold or decommissioned.

Both the AER and Lexin acknowledge there were health and safety concerns at the company's sour gas operations. The AER is managing those issues now, but it's unclear who exactly will be ultimately responsible for the cleanup, once this has played out in the courts.

You can read more about the AER's claims against Lexin Resources here.

Lexin's statement of defence is below and available here.