Bay Area police pulled over a California privacy advocate and held him at gunpoint after a database error caused a a license plate reader to flag a car as stolen, a lawsuit alleges.

Brian Hofer, chair of Oakland’s Privacy Advisory Commission, said in a suit filed in December that he had rented a car and was traveling with his brother in November when he was pulled over by a Contra Costa Sheriff’s Office deputy, and more police cars joined. Hofer alleges that an officer had a gun drawn and told him and his brother to exit the rental car, and that a deputy injured his brother by throwing him to the ground.

They say they were held by officers for about 40 minutes

The suit alleges the officers then searched the car without consent, and after checking the brothers’ IDs, told them an automatic license plate reader had detected that the car they were in was stolen. Hofer, according to the suit, let an officer check the rental car app on his phone to prove he’d rented it. After allegedly spending about 40 minutes detained by the officers, the two brothers were released.

The complaint, filed against multiple officers, alleges that the incident was a violation of Hofer’s Fourth Amendment rights.

“The Deputy Sheriffs involved in this case followed procedure and acted appropriately,” a spokesperson for the sheriff’s office said in a statement. “The vehicle was reported stolen. As the car was occupied, a high risk enforcement stop was conducted. Once it was confirmed the driver was not a suspect, he was removed from the patrol car and the handcuffs removed. He was released at the scene.”

The spokesperson added that the car was stolen at one point but that, for an unknown reason, the system wasn’t updated after the stolen car was recovered.

The Contra Costa Sheriff’s Office did not immediately respond to a request for comment. But in an interview with KTVU, Hofer acknowledged the irony of law enforcement pulling over a privacy advocate after an error. “They picked the wrong guy,” he told the station.

Update, 11:44 AM ET: Includes statement from sheriff’s office and more information on the source of the error.