Alberta government coffers are short an estimated $120 million after the province lost a six-year battle against nearly a dozen corporations it argued were illegally avoiding paying tax.

Two of the firms — Canada Safeway Ltd. and Husky Energy Inc. — convinced the courts their sophisticated plans were a legitimate means of minimizing their corporate levy.

When the country’s top court refused last month to hear Alberta’s appeal of those decisions, provincial bureaucrats had to give up on collecting a share of the billions in earnings that 11 companies had shifted out of Alberta using offshore firms.

A high-ranking official with Alberta Finance and Enterprise — whom the Herald has agreed not to identify — said the province was deeply disappointed with the outcome.

“There was a lot of time and effort put into these cases and we believed we were right,” said the official, “but we’re not going to start badmouthing the courts in Alberta, nor are we going to start expressing displeasure about the Supreme Court of Canada.”

Some of the strategies, which exploited inconsistencies among provincial tax laws, had been in use since the mid-1990s.

But court records indicate Alberta officials began investigating only after they were tipped off to the burgeoning problem in late 2005 by their counterparts in Ontario.

Earlier that year, the province had closed a loophole in its corporate tax legislation that allowed firms to minimize tax through a strategy that was known in the industry as the “Ontario shuffle.”

In Safeway’s case, the Calgary-based company set up a related finance corporation in 2001 that was resident in Ontario but incorporated in the British Virgin Islands.

Safeway then borrowed money from that offshore corporation and paid it interest that was exempt from tax under Ontario’s law at the time. That money was then paid back to another Safeway holding company as inter-corporate dividends that were deductible.

The plan was neutral from a federal standpoint, but it saved the grocery giant an estimated $16.6 million in Alberta tax over three years.

Court records show Deloitte and Touche approached Safeway in 2000 with a “proprietary plan” to minimize tax. The accounting firm was paid fees of nearly $1.2 million for implementing the strategy.

After the province assembled a team of nine auditors in early 2007 into an aggressive tax planning unit, it was able to identify 57 corporations that had used the shuffle or similar schemes to avoid approximately $200 million in taxes.

Some 46 of the companies agreed to settle and the province recouped about $80 million.

But the others, including Safeway and Husky, refused to accept their reassessments so the matter ended up before the courts.

In a 2011 ruling that was upheld on appeal, Justice Barbara Romaine ruled Safeway’s “scheme” to transfer income and take advantage of a lower rate was not abusive.

“The free flow of capital across Canada is constitutionally protected and choosing where to employ capital to obtain the most favourable tax result is legitimate tax minimization,” Romaine said.