WASHINGTON - The Supreme Court on Monday upheld a North Carolina car search, in an 8-1 decision that provides more wiggle room for law enforcement officers who make a "reasonable" mistake about the law.

With conservative and liberal justices all but united, the court ruled that the 2009 search was permissible even though the Surry County Sheriff's Office sergeant who conducted it erred in thinking the car violated state law governing warning brake lights.

"To be reasonable is not to be perfect, and so the Fourth Amendment allows for some mistakes on the part of government officials, giving them fair leeway for enforcing the law in the community's protection," Chief Justice John Roberts Jr. wrote.

Justice Sonia Sotomayor was the sole dissenter, arguing that the decision means "further eroding the Fourth Amendment's protection of civil liberties in a context where that protection has already been worn down."

The Fourth Amendment prohibits unreasonable searches and seizures. The Supreme Court has previously ruled that a search might be permissible if the officer makes a reasonable factual mistake.

Underscoring the case's broader significance, 19 states filed a brief siding with North Carolina.

The case grew out of a police stop on the morning of April 29, 2009, when Sgt. Matt Darisse of Surry County pulled over a Ford Escort on Interstate 77 near Dobson, N.C., about 90 miles north of Charlotte. Darisse had begun following the car because he thought the driver looked "stiff and nervous."

Darisse thought he had reason to pull the car over and subsequently search it when he noticed that only one of its brake lights went on while the car slowed. At the time, Darisse said he thought North Carolina law required that cars have two working brake lights; the North Carolina Court of Appeals later ruled Darisse was wrong.

The driver, who was not involved in the case decided Monday, and the car's owner, Nicholas Brady Heien, did not object to a search. Following a search of about 40 minutes, Darisse found in the side compartment of a duffle bag a sandwich bag containing cocaine.