A charge of possessing cocaine for supply has been dismissed after the court found the officer had no reason to search the car it was in.
A man was facing the charge after a police officer approached him and his friend in an Auckland carpark.
The court was told the officer called out 'hey, what are you up to' before approaching the man's friend, who ignored the officer and walked back to the car.
The officer told the court he had spotted a craft knife inside the car before carrying out a search and finding cocaine.
However, the man works in the construction industry and had other tools in his car as well.
The court found there was no initial reason to approach the car and the officer had not asked the man if he had a lawful reason for having the knife.
The man's lawyer alleged police had only approached her client and his friend in an Auckland carpark at night because of their skin colour, but Judge Jonathan Down found there was no bad faith.
Judge Down said the officer had approached the men out of a desire to be a good officer.
He ruled the charge should be dismissed due to the breaches and delays.