(a) Except as provided by the provisions of this section and the provisions of section five of this article, neither a municipality nor the governing body of any municipality may, by ordinance or otherwise, limit the right of any person to purchase, possess, transfer, own, carry, transport, sell or store any revolver, pistol, rifle or shotgun or any ammunition or ammunition components to be used therewith nor to so regulate the keeping of gunpowder so as to directly or indirectly prohibit the ownership of the ammunition in any manner inconsistent with or in conflict with state law.
(b) For the purposes of this section:
(1) "Municipally owned or operated building" means any building that is used for the business of the municipality, such as a courthouse, city hall, convention center, administrative building or other similar municipal building used for a municipal purpose permitted by state law: Provided, That "municipally owned or operated building" does not include a building owned by a municipality that is leased to a private entity where the municipality primarily serves as a property owner receiving rental payments.
(2) "Municipally owned recreation facility" means any municipal swimming pool, recreation center, sports facility, facility housing an after-school program or other similar facility where children are regularly present.
(c)(1) A municipality may enact and enforce an ordinance or ordinances that prohibit or regulate the carrying or possessing of a firearm in municipally owned or operated buildings.
(2) A municipality may enact and enforce an ordinance or ordinances that prohibit a person from carrying or possessing a firearm openly or that is not lawfully concealed in a municipally owned recreation facility: Provided, That a municipality may not prohibit a person with a valid concealed handgun permit from carrying an otherwise lawfully possessed firearm into a municipally owned recreation facility and securely storing the firearm out of view and access to others during their time at the municipally owned recreation facility.
(3) A person may keep an otherwise lawfully possessed firearm in a motor vehicle in municipal public parking facilities if the vehicle is locked and the firearm is out of view.
(4) A municipality may not prohibit or regulate the carrying or possessing of a firearm on municipally owned or operated property other than municipally owned or operated buildings and municipally owned recreation facilities pursuant to subdivisions (1) and (2) of this section: Provided, That a municipality may prohibit persons who do not have a valid concealed handgun license from carrying or possessing a firearm on municipally owned or operated property.
(d) It shall be an absolute defense to an action for an alleged violation of an ordinance authorized by this section prohibiting or regulating the possession of a firearm that the person: (1) Upon being requested to do so, left the premises with the firearm or temporarily relinquished the firearm in response to being informed that his or her possession of the firearm was contrary to municipal ordinance; and (2) but for the municipal ordinance the person was lawfully in possession of the firearm.
(e) Any municipality that enacts an ordinance regulating or prohibiting the carrying or possessing of a firearm pursuant to subsection (c) of this section shall prominently post a clear statement at each entrance to all applicable municipally owned or operated buildings or municipally owned recreation facilities setting forth the terms of the regulation or prohibition.
(f) Redress for an alleged violation of this section may be sought through the provisions of chapter fifty-three of this code, which may include the awarding of reasonable attorneys fees and costs.
(g) Upon the effective date of this section, section fourteen, article seven, chapter sixty-one of this code is inapplicable to municipalities. For the purposes of that section, municipalities may not be considered a person charged with the care, custody and control of real property.
(h) This section does not:
(1) Impair the authority of any municipality, or the governing body thereof, to enact any ordinance or resolution respecting the power to arrest, convict and punish any individual under the provisions of subdivision (16), section five of this article or from enforcing any such ordinance or resolution;
(2) Authorize municipalities to restrict the carrying or possessing of firearms, which are otherwise lawfully possessed, on public streets and sidewalks of the municipality: Provided, That whenever pedestrian or vehicular traffic is prohibited in an area of a municipality for the purpose of a temporary event of limited duration, not to exceed fourteen days, which is authorized by a municipality, a municipality may prohibit persons who do not have a valid concealed handgun license from possessing a firearm in the area where the event is held; or
(3) Limit the authority of a municipality to restrict the commercial use of real estate in designated areas through planning or zoning ordinances.