SANTA ROSA (CBS SF) — A 34-year-old man was in custody after a SWAT standoff and allegedly threatening an officer with a knife, authorities said.

Santa Rosa police said Markiques Andrew Valdovina was being held on charges that include suspicion of brandishing a weapon to resist or prevent arrest, resisting by means of threat or violence, resisting or obstructing a peace officer and on three outstanding warrants for domestic violence.

READ MORE: Red Flag Warning Elevates Wildfire Fears Among Bay Area Residents

On Wednesday, officers conducted a traffic stop on a vehicle in the 600 block of Russell Avenue that was related to a report of a man brandishing a knife in the 4300 block of Chico Ave.

Valdovina was a passenger in the vehicle.

READ MORE: One Dead, Three Wounded In Early Sunday Morning Shooting In Oakland's Uptown Neighborhood

When the driver of the vehicle pulled over in an apartment complex, Valdovina got out of the vehicle with a knife in his hand and made aggressive and threatening motions toward an officer, police said. After several commands, Valdovina dropped the knife and threw an object at the officer.

The object hit the officer in the leg. Valdovina then ran into a storage shed in the apartment complex parking lot and barricaded himself inside. Additional officers and hostage team negotiators were called to the scene, and after two hours of attempting to get Valdovina to surrender, the police department’s SWAT team and a K9 team forced entry into the shed and took the suspect in to custody.

MORE NEWS: VIDEO: Smash-and-Grab Suspects Arrested In Brazen Serramonte Center Jewelry Store Robbery

Valdovina suffered minor injuries to his right ankle as he was being apprehended.