TORONTO -- A traffic officer who routinely searched vehicles he stopped was out of line and should have known better, Ontario's top court ruled Wednesday.

In throwing out a drug conviction, the court found a car search by Const. Robert Sinclair violated the rights of the accused, Alexander Harflett.

"I do not doubt that Const. Sinclair believes that he is doing the right thing," the Court of Appeal said.

"(But) as an instructor of other police officers, he ought to be fully conversant with his legal authority -- but the evidence shows either that he was not or that he was prepared to search regardless."

Sinclair, with the Ontario Provincial Police highway enforcement team, was at a service centre on Highway 401 when he spotted a vehicle with Quebec plates. As a demonstration for a colleague, the officer ran a search on the places and found Harflett's driver's licence had been suspended for unpaid fines.

The officer pulled him over down the highway, where Harflett, of Oshawa, Ont., produced a valid Quebec licence.

Sinclair arrested him for using another licence while his Ontario one was suspended. He also called a tow truck to move the car from the highway to a nearby hotel to allow Harflett to pay his fines and get his licence back.

Sinclair then took what he called an "inventory" of the vehicle -- something he testified he always did -- an approach that didn't sit well with the Appeal Court.

"He resisted the notion that what he did was a 'search;' this was plainly a search," the Appeal Court said.

"A check stop does not and cannot constitute a general search warrant for searching every vehicle, driver and passenger that is pulled over."

During the search, Sinclair discovered marijuana in the trunk. He arrested Harflett for possessing the drug for trafficking purposes.

At trial, Sinclair admitted he had been conducting a traffic investigation when he detained the accused and had no reason to suspect any criminality. However, he argued he needed to verify if the car had any valuables or dangerous items inside.

In March 2014, Ontario court Judge Catherine Kehoe found his actions reasonable, decided any violation of the accused's rights was technical or minor, admitted the drug evidence, and convicted him.

In throwing out the case, the Appeal Court found Sinclair had no authority for the search.

"The inventory search cannot be justified on the basis of officer safety or any suspicion that the appellant was involved in criminal conduct," the Appeal Court said. "Sinclair had no public safety concerns, since he was going to release the car to the appellant."

The court also noted two other cases where Sinclair had been found to have abused his search powers leading to the exclusion of evidence.

"The impact of an unjustified search is magnified where there is a total absence of justification for it," the court said.

Without the drugs as evidence, the prosecution had no case, so the Appeal Court entered an acquittal.