It was a longshot legal argument.

But David William Main is a man used to taking risks.

A self-confessed Lego thief with a weakness for gambling and drugs, Main extended a winning streak at the slots to a provincial courtroom this week.

The 51-year-old beat a trafficking charge by arguing that successive casino windfalls allowed him to purchase fentanyl and methamphetamine in amounts normally reserved for drug dealers.

"In the unusual circumstances of this case, it is difficult to exclude the real possibility that, at least on this occasion, Mr. Main is an exception to the typical pattern given his receipt of a significant amount of money earlier that day," said Port Coquitlam Provincial Court Judge Robin McQuillan.

Lego sets for drugs

McQuillan acquitted Main on Monday on two counts of possession for the purpose of trafficking.

The judge still found him guilty of possession of drugs, but the more serious charge could have seen Main face a minimum of one to two years in prison.

It's not an environment he would have been unfamiliar with.

Police only questioned Main after he tried to use an inmate's identification card to claim a $4,140 jackpot at Coquitlam's Hard Rock Casino.

The children of a West Vancouver Police officer built this recreation of the arrest scene of a gang of Lego thieves who steal the popular sets for drug money. (West Vancouver Police)

According to the ruling, Main has been a heavy drug user for the past four or five years. He claimed he last worked three years ago and was receiving employment insurance benefits up until January 2018, the time of his arrest.

"At this point, he concedes that the costs of his drug habit exceeded his income," the ruling said.

"He said he made up that difference by shoplifting, which was often Lego sets that he exchanged with dealers for drugs."

The high retail price of Lego sets makes the building block toys popular with criminal organizations. A few years ago, Richmond RCMP busted a so-called "Lego Gang" for stealing and re-selling the sets to order.

'He would take all of it'

Main claimed he won $7,230 at a slot machine at the Elements Casino a month before his arrest, but that he was unable to cash out because his wallet and most of his ID had been stolen.

He went to a notary public with a friend on Jan. 3, 2018 and obtained a statutory declaration "in which she declared that she personally knows Mr. Main and that he is the person identified in an attached inmate identification card."

The pair then went to Elements Casino and were provided with Main's slot machine winnings in cash.

Upon receiving his cash payout from one casino, David William Main claimed that he went straight to a favourite slot machine at another. (CBC)

Main claimed he then found his regular drug dealer and asked if he had any methamphetamine and fentanyl.

"Mr. Main told the dealer that he would take all of it," the judge wrote.

It was a lot of drugs, but Main said he got a deal for buying in bulk. He also said he thought he would attract less scrutiny if he made one purchase instead of several.

It was unusual, but "this was however, the first time he had received a windfall and spent such a large amount on drugs."

'An unprecedented winning streak'

Armed with his hard drugs, Main and his friend headed for the Hard Rock.

"Mr. Main went to the dollar slot machines, and specifically a slot machine that was a favourite of his," McQuillan wrote.

"He put $200 in the machine and he soon won a jackpot of approximately $3,500."

An attendant gave Main his money and re-set the machine. Main won another jackpot of $1,550.

A B.C. provincial court judge said that while he couldn't accept all of the gambling Lego thief's evidence, he couldn't rule out the possibility that he bought a large quantity of drugs with a slot machine windfall. (David Horemans/CBC)

"He was on an unprecedented winning streak," the judge wrote.

"He had won a $3,500 cash pay-out, a $1,550 cash pay-out and had accumulated a further $4,180 in winnings that could be cashed out with the voucher."

But when Main went to use the inmate ID again the RCMP showed with a prize he hadn't been so eager to collect: an outstanding arrest warrant.

What are the odds?

During his arrest, police found 16 baggies of fentanyl, about 21 grams of methamphetamine and $11,338.10 in cash — mostly in $100 and $20 bills.

An RCMP expert testified that given the circumstances, and the fact that heavy drug users usually only carry enough for daily use, the only reasonable conclusion was that Main intended to traffic the drugs.

"He acknowledges however, that he has never encountered an individual drug user who has purchased larger quantities of drugs as a result of coming into a windfall as asserted by Mr. Main in this case," the judge wrote.

In the end, McQuillan said that while he couldn't entirely accept Main's evidence, he was left with enough doubt that he couldn't find him guilty of the more serious charge.

It was a bittersweet victory for Main, who is currently behind bars awaiting a bail hearing on another matter next month in Surrey provincial court.

He's charged with possession for the purpose of trafficking.