Joaquín Guzmán Loera, the notorious drug lord known as El Chapo who twice slipped out of high-security Mexican prisons and into criminal legend, was extradited to the United States on Thursday night, officials said, drawing to a close a decades-long quest to prosecute the head of one of the world’s largest narcotics organizations. A federal court in Mexico denied an appeal by Mr. Guzmán’s lawyers to block the extradition, clearing the way for his transfer to the American authorities in New York, where he faces numerous charges for his role as the chieftain of the Sinaloa cartel. Mr. Guzmán was put on a plane on Thursday in Ciudad Juárez, near the border with Texas, and was set to arrive in the United States as President Obama leaves office.

The decision to extradite Mr. Guzmán was an about-face for the Mexican government, which once claimed that he would serve his long sentence in Mexico first. However, after his Houdini-like escape in 2015, when his associates tunneled him out of Mexico’s most secure prison, officials began to reconsider. When he was recaptured early last year, after one of Mexico’s most exhaustive manhunts, the government publicly said it would allow the extradition of Mr. Guzmán, thus relieving itself of the potential embarrassment of another escape and preventing further souring of its relationship with the United States.