Charges against an alleged drug trafficker from B.C.'s Fraser Valley will not be stayed, even though a local police officer was caught on camera stuffing cash from the accused’s home into his sock.

While the officer's actions are troubling, dismissing the charges against Abbotsford resident Brian MacDonald would be a disproportionate response, the provincial court judge overseeing the case ruled Friday.

"It is clearly in the interest of society to have the charges against Mr. MacDonald dealt with," Judge Edna Ritchie wrote in her decision.

MacDonald was charged with several counts of drug possession for the purpose of trafficking last fall following an investigation by the Abbotsford Police Department.

But while police were executing a search warrant at his home, a surveillance camera caught one officer, identified in court documents by his rank and surname, Const. Sovio, picking up money at the property and tucking it away in a sock.

Back in April, the officer took the stand in MacDonald's trial and admitted to touching the cash, but said he only did it as a joke.

"He advises that he was in the middle of doing a practical joke," Sgt. Judy Bird, spokesperson for Abbotsford police, told CTV News at the time.

According to Judge Ritchie's decision, Sovio testified that the plan for the joke was to pull the money out and present it to another officer as "the real jackpot."

"He described it as going to be an 'aha' moment," Ritchie wrote.

The officer also insisted he left the money at MacDonald's home.

MacDonald's lawyer, Ken Beatch, argued the case against his client should be thrown out because the officer's conduct threatens to jeopardize the public's trust in police.

"The real issue was the integrity of the system," said Beatch.

But the judge, who did not make a determination on whether a theft had occurred, said the case can go forward without condoning the officer's actions.

She also found the charges – which involve the deadly opioids fentanyl and carfentanil – are serious enough that it's in the public's interest to go forward.

MacDonald's lawyer said he hasn't decided if he'll be appealing Ritchie's decision.

The RCMP was called in as an outside police agency to investigate whether the Abbotsford officer stole the cash, and the probe is still underway. Bird has said even a practical joke involving evidence at a crime scene would be inappropriate.

In the meantime, the officer has been removed from operational duties.

With files from CTV Vancouver’s Maria Weisgarber