Rafael Caro Quintero, the man known as the grandfather of Mexican drug trafficking, was ordered released from a Mexican prison Friday morning after a court overturned his 40-year sentence.

Caro Quintero, 61, received 40 years in prison for the kidnapping and murder of U.S. Drug Enforcement Administration agent Enrique Carena. The Mexican court that overturned the sentence ordered Caro Quintero released on procedural grounds, contending that his case should have been treated as a state offense and not a federal one, the Associated Press reported.

The court, in Jalisco, said Caro Quintero’s case should have been tried locally because he is not a diplomatic or consular agent, according to CNN Mexico.

Caro Quintero was imprisoned on other charges, but he’s already served time on those offenses, an anonymous court official told the AP.

Caro Quintero was the leader of Mexico’s Guadalajara Cartel in 1985 when he was arrested. The cartel is no longer in operation.

But Caro Quintero’s legal troubles may not be over. A court in California wants the 61-year-old grandfather of Mexican drug trafficking to be tried on murder and drug possession charges, according to CNN Mexico. U.S. prosecutors are seeking the death penalty, the news outlet said.

A lower court ordered an injunction in Caro Quintero’s case, and the order was upheld by a higher Mexican court, meaning that the 61-year-old will be released from prison “in the coming hours,” CNN Mexico reported. He has served 28 years of his 40-year sentence.

The decision to release Caro Quintero riled some Twitter users. "Caro Quintero" was trending worldwide on the social media website Friday.

“I listened to part of the audio tape of DEA agent's torture. This is an outrage!!” tweeted William Worthington of Baylor University.

Caro Quintero’s younger brother, Miguel Angel Caro Quintero, pleaded guilty in 2009 to racketeering and drug charges in Denver federal court.

The younger Caro Quintero, a leader of the Sonora Cartel, admitted to trafficking more than 100 tons of marijuana between 1985 and 1988 and sending the more than $100 million in proceeds back to Mexico, according to Reuters.