SALEM, Ore. (AP) — A Salem man has been sentenced to 23 years in prison for shooting at three Salem police officers in a car chase during a drug investigation.

Alejandro Maciel-Salcedo pleaded guilty to first- and second-degree attempted murder, assault, unlawful use of a weapon and felon in possession of a firearm, The Statesman Journal reported. Four counts of first-degree attempted murder charges were dropped as part of a plea agreement.

The Marion County District Attorney’s office said Maciel-Salcedo shot at Salem police detectives Angus Emmons, Oscar Zambrano and Anthony Burke last July 17.

On that day, Emmons, Zambrano and Burke were conducting surveillance on Maciel-Salcedo and his associates, who they alleged facilitated the delivery of a quarter-pound of methamphetamine. The detectives were placing a tracking device on Maciel-Salcedo’s car when his nephew saw the detectives and told Maciel-Salcedo.

Zambrano and Burke ran to their undercover vehicle and Emmons drove them from the scene, district attorney officials said. Maciel-Salcedo followed, according to district attorney officials.

As Emmons drove they heard a gunshot and saw Maciel-Salcedo’s car approaching. As Maciel-Salcedo pulled alongside the detective’s vehicle, at least three additional shots were fired. Emmons was struck in his left arm, officials said.

Maciel-Salcedo returned to a residence and SWAT officers found Maciel-Salcedo in an attic crawl space.