California Penal Code Section 171b[1] prohibits bringing or possessing firearms in state and local government buildings. Section 171b was already in effect by 1987.
Prohibited Conduct
PC 171b(a) provides that any person who brings or possesses any of the following items within any state or local public building, or at any meeting required to be open to the public pursuant to the Bagley-Keene Open Meeting Act or the Ralph M. Brown Act, is guilty of a public offense:
- Any firearm
- Any deadly weapon (as defined in PC 17235)
- Any knife with a blade length in excess of 4 inches
- Any unauthorized tear gas weapon
- Any taser or stun gun
- Any instrument that expels a metallic projectile by the aid of spring or air pressure
Definition of "State or Local Public Building"
PC 171b(c) covers a building or part of a building owned or leased by state or local government where public employees are regularly present to perform official duties. It excludes the locations listed in subdivision (c)(2) and buildings regularly used or intended as employee residences. The following examples qualify only if they meet those criteria.
- Legislative chambers and committee rooms are excluded to the extent they are covered by PC 171c
- Buildings that contain a courtroom, subject to PC 171b(c). Separate airport and passenger vessel terminal restrictions appear in PC 171.5[2]
- City hall buildings and offices
- County administrative buildings
- State office buildings
- Buildings meeting PC 171b(c). Section 171b(a) separately covers meetings required to be open to the public under the specified open-meeting laws
Exemptions
PC 171b(b) provides specific exemptions for:
- Peace officers authorized to carry firearms, whether on or off duty
- Persons summoned by a peace officer to assist in making arrests or preserving the peace
- Full-time paid peace officers of another state or the federal government who are carrying out official duties while in California
- A person who has been given written permission by an authorized official of the building
- Retired peace officers with authorization to carry concealed weapons under the article beginning with PC 25450
A CCW permit alone does not exempt its holder from PC 171b. Section 171b(b)(3) exempts a licensed carrier who possesses the firearm within a building designated for a court proceeding and is a justice, judge, or commissioner of the court.
Penalties
A violation of PC 171b involving a firearm is punishable by imprisonment in county jail for not more than one year, or in state prison. The same penalty applies to the other items listed in PC 171b(a).
Verification
10 of 10 factual claims on this page were matched to their source text as of 2026-10-16.
Show the claims
| Claim | Type | Status | Source | Checked |
|---|---|---|---|---|
| PC 171bSource text: # § 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 C | STAT | verified against source | None | 2026-10-16 |
| Penal Code Section 171bSource text: # § 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 C | STAT | verified against source | None | 2026-10-16 |
| California Penal Code Section 171bSource text: # § 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 C | STAT | verified against source | None | 2026-10-16 |
| PC 171b(a)Source text: # § 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 C | STAT | verified against source | None | 2026-10-16 |
| PC 17235Source text: # § 17235 As used in this part, “switchblade knife” means a knife having the appearance of a pocketknife and includes a spring-blade knife, snap-blade knife, g | STAT | verified against source | None | 2026-10-16 |
| PC 171b(c)Source text: # § 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 C | STAT | verified against source | None | 2026-10-16 |
| PC 171cSource text: # § 171c ## (a) (1) Any person who brings a loaded firearm into, or possesses a loaded firearm within, the State Capitol, the state office building at 1021 O | STAT | verified against source | None | 2026-10-16 |
| PC 171.5Source text: # § 171.5 ## (a) For purposes of this section: (1) “Airport” means an airport, with a secured area, that regularly serves an air carrier holding a certificat | STAT | verified against source | None | 2026-10-16 |
| PC 171b(b)Source text: # § 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 C | STAT | verified against source | None | 2026-10-16 |
| PC 25450Source text: # § 25450 As provided in this article, Section 25400 does not apply to, or affect, any of the following: ## (a) Any peace officer, listed in Section 830.1 or | STAT | verified against source | None | 2026-10-16 |
Sources
[1] California Legislature. Penal Code Section 171b
Part 1, Title 11, Section 171b
[2] California Legislature. Penal Code Section 171.5
Part 1, Title 11, Section 171.5