[What you need to know to start the day: Get New York Today in your inbox.]

He was one of the most notorious outlaws of the last 100 years: a brutal Mexican cartel leader, a wily trafficker who smuggled more than $12 billion worth of drugs and plunged his country into a long-running tragedy of bloodshed and corruption.

But on Wednesday morning, the 30-year criminal career of Joaquín Guzmán Loera, known to the world as El Chapo, reached its final chapter as a federal judge in New York City sentenced him to life in prison.

The life term, mandated by law as a result of the severity of Mr. Guzmán’s crimes, was handed down in Federal District Court in Brooklyn, where the kingpin was convicted last winter of drug, murder and money laundering charges after a sprawling three-month trial.

[Related: El Chapo sentencing a “Pyrrhic victory” for Mexico.]

As some of the federal agents who had chased him for years looked on from the gallery, Judge Brian M. Cogan issued the sentence and Mr. Guzmán, 62, was hauled away to prepare himself — pending an appeal — for spending the rest of his life behind bars.