An Ontario judge has dismissed all drug charges against Alexander Lisi, Rob Ford's friend and former driver.

Jamshid (Jay) Bahrami, Lisi's co-accused, was also dismissed charges he was facing in provincial court in Toronto Friday.

Judge Ramez Khawly delivered the verdict at the end of a two-hour long ruling during which he barred anyone from coming or going from the courtroom while he spoke.

"Stripped of the elephant looming large in the courtroom, this case is as mundane as it comes. What changes the dynamics here is the breadth of the police manpower and the accompanying amount of ink," Khawly told the court, referring to the case's link to Ford, Toronto's former mayor who is now a city councillor.

Lisi, 36, and Bahrami, 49, had both been charged with trafficking marijuana. Lisi was also charged with possession of a small quantity of marijuana and possession of the proceeds of crime, while Bahrami was charged with cocaine possession.

Both men pleaded not guilty to the charges against them at the outset of the trial, being heard by a judge alone.

In his ruling, Khawly said he couldn't rely on the evidence of Det. Ross Fernandes, an undercover police officer who befriended Bahrami and later bought $900 worth of pot from him. The same officer later attempted to use Bahrami to set up a meeting with Lisi.

Ensnaring Bahrami "worked effortlessly," Khawly said.

"This area of the undercover evidence is too pat, too convenient," he said.

The prosecution's case was undercut by the loss of that evidence.

"The Crown's case is like a house with a debilitating crack," Khawly said.

Fernandes's information, the judge said, "is a vital building block. Without him, the Crown faces an unenviable daunting task."