The Paso Robles, California, Police Department announced Thursday night that officers had shot and killed the gunman who has been on the run since early Wednesday after he allegedly targeted a precinct and seriously wounded a San Luis Obispo County deputy. He is also believed to be responsible for the murder of a transient man in the area.

Three officers were wounded by the gunman in two separate incidents, police said. Their injuries are all considered non-life threatening.

While searching for the suspect, identified by police as 26-year-old Mason James Lira, an Arroyo Grande police officer, also a member of the San Luis Obispo Regional SWAT Team, was shot by the suspect, according to the city of Arroyo Grande.

Police say officers reported to the shooting and came under fire from the suspect, who had been hiding in a riverbed. Two more officers were shot in pursuit of Lira, before he was shot himself.

He was pronounced dead at the scene, police told ABC.

Local law enforcement, the California Highway Patrol and the FBI had been searching for the suspect since they believe he opened fire on law enforcement at about 3 a.m. Wednesday.

Nicholas Dreyfus, a 28-year old deputy with the San Luis Obispo County Sheriff's Office, responded to the early morning shooting and was shot in the face, officials said. His prognosis is good, the sheriff's office said.