NEW YORK (AP) — A federal narcotics agent has been sentenced to four years in federal prison for his role in a drug conspiracy involving thousands of kilograms of cocaine smuggled from Puerto Rico to New York.

Fernando Gomez broke down in Manhattan federal court Wednesday as he apologized for betraying his oath.

Prosecutors accused the former police officer of infiltrating the U.S. Drug Enforcement Administration in 2011 and then helping a drug-trafficking organization that has been blamed for several killings.

U.S. District Judge Jesse Furman said there are unanswered questions about Gomez’s hiring. He said the case has left a stain on the DEA.