Police can use evidence seized during a traffic stop even if it turns out the officers initially pulled a car over based on a misunderstanding of the law, the Supreme Court ruled Monday.

The 8-1 decision written by Chief Justice John Roberts said that such a stop does not violate the Constitution's protection against unreasonable searches.

The ruling came in a North Carolina case in which a police officer pulled over Nicholas Heien's car because the right brake light was out, although the left one still worked. A consensual search led to the discovery of cocaine in the trunk.

A state appeals court said the stop was impermissible because a quirky state law only requires a car to have one functioning brake light. But the state's highest court reversed, finding that the officer's mistaken reading of the law was reasonable.

The Supreme Court agreed, finding that the Fourth Amendment requires police to act reasonably, but not perfectly. Roberts said that just as a police officer's mistake of fact can justify a traffic stop, a reasonable misunderstanding about the law can also satisfy the Constitution.

The ruling means Heien can't try to overturn his conviction for drug trafficking by suppressing the drug evidence found in his car.

Heien had argued that ignorance of the law is no excuse for citizens accused of crimes and said there shouldn't be a double standard for police. But Roberts said that simply means the state can't impose a punishment for something that isn't illegal.

"Heien is not appealing a brake-light ticket," Roberts said. "He is appealing a cocaine-trafficking conviction as to which there is no asserted mistake of fact or law."

Heien was a passenger when his car was pulled over on a North Carolina highway in 2009 because the right brake light was out. Officer Matt Darisse of the Surry County Sheriff's Department issued a warning citation over the light to the driver, Maynor Javier Vasquez.

Darisse then asked for permission to search the inside of the car and Heiein consented. The search revealed a plastic sandwich bag of cocaine in the trunk.

Roberts said the officer's decision to stop the car in the first place was reasonable given the confusing way in which the law was worded. Under North Carolina's decades-old law, all cars made after 1955 are required to have a "stop lamp" that can be part of "one or more other rear lamps." But no court had ever interpreted the law in the modern era to require only one working brake light.

"I suspect most of you here were surprised to learn that only one brake light is required in North Carolina, even if you are from North Carolina," Roberts said Monday as he read his opinion from the bench.

Both the state and the Obama administration had argued that refusing to allow such stops would inject too much uncertainty into the daily actions of police in the field who need to make quick decisions. Reasonable mistakes of law are acceptable, they argued, especially when dealing with a complex law that might be subject to different interpretations.

Justice Sonia Sotomayor was the lone dissenter. She said an officer's mistake of law "no matter how reasonable, cannot support the individualized suspicion necessary to justify a seizure under the Fourth Amendment."

The notion that the law "is definite and knowable sits at the foundation of our legal system," Sotomayor said. "And it is courts, not officers, that are in the best position to interpret the laws."