Section 18B. Whoever, while in the commission of or the attempted commission of an offense which may be punished by imprisonment in the state prison, has in his possession or under his control a firearm, rifle or shotgun shall, in addition to the penalty for such offense, be punished by imprisonment in the state prison for not less than five years; provided, however, that if such firearm, rifle or shotgun is a large capacity weapon, as defined in section 121 of chapter 140, or if such person, while in the commission or attempted commission of such offense, has in his possession or under his control a machine gun, as defined in said section 121, such person shall be punished by imprisonment in the state prison for not less than ten years. Whoever has committed an offense which may be punished by imprisonment in the state prison and had in his possession or under his control a firearm, rifle or shotgun including, but not limited to, a large capacity weapon or machine gun and who thereafter, while in the commission or the attempted commission of a second or subsequent offense which may be punished by imprisonment in the state prison, has in his possession or under his control a firearm, rifle or shotgun shall, in addition to the penalty for such offense, be punished by imprisonment in the state prison for not less than 20 years; provided, however, that if such firearm, rifle or shotgun is a large capacity semiautomatic weapon or if such person, while in the commission or attempted commission of such offense, has in his possession or under his control a machine gun, such person shall be punished by imprisonment in the state prison for not less than 25 years.
A sentence imposed under this section for a second or subsequent offense shall not be reduced nor suspended, nor shall any person convicted under this section be eligible for probation, parole, furlough or work release or receive any deduction from his sentence for good conduct until he shall have served the minimum term of such additional sentence; provided, however, that the commissioner of correction may, on the recommendation of the warden, superintendent or other person in charge of a correctional institution or the administrator of a county correctional institution, grant to such offender a temporary release in the custody of an officer of such institution for the following purposes only: (i) to attend the funeral of a spouse or next of kin; (ii) to visit a critically ill close relative or spouse; or (iii) to obtain emergency medical services unavailable at such institution. Prosecutions commenced under this section shall neither be continued without a finding nor placed on file. The provisions of section 87 of chapter 276 relative to the power of the court to place certain offenders on probation shall not apply to any person 18 years of age or over charged with a violation of this section.