CA Penal Code § 171b (2021)
2021 California Code|Penal Code - PEN|PART 1 - OF CRIMES AND PUNISHMENTS|TITLE 7 - OF CRIMES AGAINST PUBLIC JUSTICE|CHAPTER 7 - Other Offenses Against Public Justice|Section 171b.

171b.  (a) Any person who brings or possesses within any state or local public building or at any meeting required to be open to the public pursuant to Chapter 9 (commencing with Section 54950) of Part 1 of Division 2 of Title 5 of, or Article 9 (commencing with Section 11120) of Chapter 1 of Part 1 of Division 3 of Title 2 of, the Government Code, any of the following is guilty of a public offense punishable by imprisonment in a county jail for not more than one year, or in the state prison:(1) Any firearm.(2) Any deadly weapon described in Section 17235 or in any provision listed in Section 16590.(3) Any knife with a blade length in excess of four inches, the blade of which is fixed or is capable of being fixed in an unguarded position by the use of one or two hands.(4) Any unauthorized tear gas weapon.(5) Any taser or stun gun, as defined in Section 244.5.(6) Any instrument that expels a metallic projectile, such as a BB or pellet, through the force of air pressure, CO2 pressure, or spring action, or any spot marker gun or paint gun.(b) Subdivision (a) shall not apply to, or affect, any of the following:(1) A person who possesses weapons in, or transports weapons into, a court of law to be used as evidence.(2) (A) A duly appointed peace officer as defined in Chapter 4.5 (commencing with Section 830) of Title 3 of Part 2, a retired peace officer with authorization to carry concealed weapons as described in Article 2 (commencing with Section 25450) of Chapter 2 of Division 5 of Title 4 of Part 6, a full-time paid peace officer of another state or the federal government who is carrying out official duties while in California, or any person summoned by any of these officers to assist in making arrests or preserving the peace while he or she is actually engaged in assisting the officer.(B) Notwithstanding subparagraph (A), subdivision (a) shall apply to any person who brings or possesses any weapon specified therein within any courtroom if he or she is a party to an action pending before the court.(3) A person holding a valid license to carry the firearm pursuant to Chapter 4 (commencing with Section 26150) of Division 5 of Title 4 of Part 6.(4) A person who has permission to possess that weapon granted in writing by a duly authorized official who is in charge of the security of the state or local government building.(5) A person who lawfully resides in, lawfully owns, or is in lawful possession of, that building with respect to those portions of the building that are not owned or leased by the state or local government.(6) A person licensed or registered in accordance with, and acting within the course and scope of, Chapter 11.5 (commencing with Section 7512) or Chapter 11.6 (commencing with Section 7590) of Division 3 of the Business and Professions Code who has been hired by the owner or manager of the building if the person has permission pursuant to paragraph (5).(7) (A) A person who, for the purpose of sale or trade, brings any weapon that may otherwise be lawfully transferred, into a gun show conducted pursuant to Article 1 (commencing with Section 27200) and Article 2 (commencing with Section 27300) of Chapter 3 of Division 6 of Title 4 of Part 6.(B) A person who, for purposes of an authorized public exhibition, brings any weapon that may otherwise be lawfully possessed, into a gun show conducted pursuant to Article 1 (commencing with Section 27200) and Article 2 (commencing with Section 27300) of Chapter 3 of Division 6 of Title 4 of Part 6.(c) As used in this section, “state or local public building” means a building that meets all of the following criteria:(1) It is a building or part of a building owned or leased by the state or local government, if state or local public employees are regularly present for the purposes of performing their official duties. A state or local public building includes, but is not limited to, a building that contains a courtroom.(2) It is not a building or facility, or a part thereof, that is referred to in Section 171c, 171d, 626.9, 626.95, or 626.10 of this code, or in Section 18544 of the Elections Code.(3) It is a building not regularly used, and not intended to be used, by state or local employees as a place of residence.(Amended by Stats. 2010, Ch. 178, Sec. 45. (SB 1115) Effective January 1, 2011. Operative January 1, 2012, by Sec. 107 of Ch. 178.)