5/24-1.1. Unlawful Use or Possession of Weapons by Felons or Persons in the Custody of the Department of Corrections Facilities
(a) It is unlawful for a person to knowingly possess on or about his person or on his land or in his own abode or fixed place of business any weapon prohibited under Section 24-1 of this Act or any firearm or any firearm ammunition if the person has been convicted of a felony under the laws of this State or any other jurisdiction. This Section shall not apply if the person has been granted relief by the Director of the Department of State Police under Section 10 of the Firearm Owners Identification Card Act.1
(b) It is unlawful for any person confined in a penal institution, which is a facility of the Illinois Department of Corrections, to possess any weapon prohibited under Section 24-1 of this Code or any firearm or firearm ammunition, regardless of the intent with which he possesses it.
(c) It shall be an affirmative defense to a violation of subsection (b), that such possession was specifically authorized by rule, regulation, or directive of the Illinois Department of Corrections or order issued pursuant thereto.
(d) The defense of necessity is not available to a person who is charged with a violation of subsection (b) of this Section.
(e) Sentence. Violation of this Section by a person not confined in a penal institution shall be a Class 3 felony for which the person shall be sentenced to no less than 2 years and no more than 10 years. A second or subsequent violation of this Section shall be a Class 2 felony for which the person shall be sentenced to a term of imprisonment of not less than 3 years and not more than 14 years, except as provided for in Section 5-4.5-110 of the Unified Code of Corrections. Violation of this Section by a person not confined in a penal institution who has been convicted of a forcible felony, a felony violation of Article 24 of this Code2 or of the Firearm Owners Identification Card Act,3 stalking or aggravated stalking, or a Class 2 or greater felony under the Illinois Controlled Substances Act,4the Cannabis Control Act,5 or the Methamphetamine Control and Community Protection Act is a Class 2 felony for which the person shall be sentenced to not less than 3 years and not more than 14 years, except as provided for in Section 5-4.5-110 of the Unified Code of Corrections. Violation of this Section by a person who is on parole or mandatory supervised release is a Class 2 felony for which the person shall be sentenced to not less than 3 years and not more than 14 years, except as provided for in Section 5-4.5-110 of the Unified Code of Corrections. Violation of this Section by a person not confined in a penal institution is a Class X felony when the firearm possessed is a machine gun. Any person who violates this Section while confined in a penal institution, which is a facility of the Illinois Department of Corrections, is guilty of a Class 1 felony, if he possesses any weapon prohibited under Section 24-1 of this Code regardless of the intent with which he possesses it, a Class X felony if he possesses any firearm, firearm ammunition or explosive, and a Class X felony for which the offender shall be sentenced to not less than 12 years and not more than 50 years when the firearm possessed is a machine gun. A violation of this Section while wearing or in possession of body armor as defined in Section 33F-1 is a Class X felony punishable by a term of imprisonment of not less than 10 years and not more than 40 years. The possession of each firearm or firearm ammunition in violation of this Section constitutes a single and separate violation.