OAKLAND — A suspect wanted for shooting at an Oakland police sergeant Saturday night as she sat dazed in her patrol SUV after a collision was arrested Thursday morning after a standoff with Stockton police, officials said.

The suspect’s name was not released by police, who said he made statements that the July 23 shooting may have been inspired by recent anti-police sentiment in areas where there have been police shootings.

The suspect was traced to a home in Stockton on Wednesday night. Police there responded to the scene and the man refused to come out.

Finally, at about 4 a.m. Stockton SWAT officers forced their way inside and arrested him. A gun was also recovered.

He was brought back to Oakland, where he was being interviewed by police.

Homicide Lt. Roland Holmgren said at a news conference Thursday that the suspect was in his late 20s and has addresses in Oakland.

“Right now we don’t know the why,” Holmgren said about a motive. He said that the suspect was possibly inspired by anti-police sentiments, but didn’t elaborate.

The man was wanted on suspicion of shooting at Oakland Sgt. Nadia Clark about 9:30 p.m. Saturday at the intersection of 73rd Avenue and Weld Street in East Oakland.

Her SUV had just been hit head-on by another SUV, causing heavy damage and leaving her dazed and pinned inside the vehicle.

It was then the suspect, who had nothing to do with the wreck, approached the police SUV and began shooting at her.

A dispatch recording captured her terror.

“I just got shot at. I can’t get out of the car,” Clark radioed as dozens of officers from Oakland and other police agencies sped to the scene.

She was freed from the SUV and taken to a hospital for treatment of injuries suffered in the wreck. She was released from the hospital Sunday.

After the shooting, police locked down streets for several blocks in all directions looking for the gunman but did not find him then.