A Chicago man has been sentenced to more than five years in federal prison for illegally possessing and trafficking two dozen handguns, most of which were stolen from a train shipping firearms on the South Side in 2015.

Warren Gates, 49, had 24 stolen firearms, according to a statement from the U.S. Attorney’s office.

Seventeen of the firearms were illegally purchased from co-defendants who stole about 111 firearms from a South Side rail yard on April 12, 2015, according to the statement. Gates admitted he bought the handguns so he could resell them for a profit, and already sold 11 before he was arrested.

Law enforcement have recovered 16 of the 111 stolen firearms at various locations and crime scenes, according to the statement.

The firearms were in a cargo train traveling from a Ruger factory in New Hampshire to Spokane, Washington. It was parked overnight in Chicago when the co-defendants broke in and stole the guns.

Gates pleaded guilty last year to one count of possession of a firearm by a prohibited person, according to the attorney’s office. He was sentenced Wednesday to 63 months in federal prison by U.S. District Judge John J. Tharp Jr.