"We have a suspect in custody and justice will be served," said LA County Sheriff Alex Villaneuva.
A man has now been charged with ambushing two Los Angeles County Sheriff's Deputies last month.
Deonte Murray is charged with two counts of attempted murder of a peace officer. He pleaded not guilty.
Surveillance video showed a person walking up to a parked police car in Compton and firing shots into the car. Two deputies were hurt and have since been released from the hospital.
If convicted of the charges, the suspect faces a maximum sentence of life in prison.
Contains footage from CNN.