California Penal Code Section 12022

(a) (1) Except as provided in subdivisions (c) and (d), any person who is armed with a firearm in the commission of a felony or attempted felony shall be punished by an additional and consecutive term of imprisonment in the state prison for one year, unless the arming is an element of that offense. This additional term shall apply to any person who is a principal in the commission of a felony or attempted felony if one or more of the principals is armed with a firearm, whether or not the person is personally armed with a firearm. (2) Except as provided in subdivision (c), and notwithstanding subdivision (d), if the firearm is an assault weapon, as defined in Section 12276 or Section 12276.1, or a machinegun, as defined in Section 12200, or a .50 BMG rifle, as defined in Section 12278, the additional and consecutive term described in this subdivision shall be three years whether or not the arming is an element of the offense of which the person was convicted. The additional term provided in this paragraph shall apply to any person who is a principal in the commission of a felony or attempted felony if one or more of the principals is armed with an assault weapon or machinegun, or a .50 BMG rifle, whether or not the person is personally armed with an assault weapon or machinegun, or a .50 BMG rifle. (b) (1) Any person who personally uses a deadly or dangerous weapon in the commission of a felony or attempted felony shall be punished by an additional and consecutive term of imprisonment in the state prison for one year, unless use of a deadly or dangerous weapon is an element of that offense. (2) If the person described in paragraph (1) has been convicted of carjacking or attempted carjacking, the additional term shall be one, two, or three years. (3) When a person is found to have personally used a deadly or dangerous weapon in the commission of a felony or attempted felony as provided in this subdivision and the weapon is owned by that person, the court shall order that the weapon be deemed a nuisance and disposed of in the manner provided in Section 12028. (c) Notwithstanding the enhancement set forth in subdivision (a), any person who is personally armed with a firearm in the commission of a violation or attempted violation of Section 11351, 11351.5, 11352, 11366.5, 11366.6, 11378, 11378.5, 11379, 11379.5, or 11379.6 of the Health and Safety Code, shall be punished by an additional and consecutive term of imprisonment in the state prison for three, four, or five years. (d) Notwithstanding the enhancement set forth in subdivision (a), any person who is not personally armed with a firearm who, knowing that another principal is personally armed with a firearm, is a principal in the commission of an offense or attempted offense specified in subdivision (c), shall be punished by an additional and consecutive term of imprisonment in the state prison for one, two, or three years. (e) For purposes of imposing an enhancement under Section 1170.1, the enhancements under this section shall count as one, single enhancement. (f) Notwithstanding any other provision of law, the court may strike the additional punishment for the enhancements provided in subdivision (c) or (d) in an unusual case where the interests of justice would best be served, if the court specifies on the record and enters into the minutes the circumstances indicating that the interests of justice would best be served by that disposition.