§ 930. Possession of firearms and dangerous weapons in Federal facilities
a. Except as provided in subsection (d), whoever knowingly possesses or causes to be present a firearm or other dangerous weapon in a Federal facility (other than a Federal court facility), or attempts to do so, shall be fined under this title or imprisoned not more than 1 year, or both.
...
(d) Subsection (a) shall not apply to-
(1) the lawful performance of official duties by an officer, agent, or employee of the United States, a State, or a political subdivision thereof, who is authorized by law to engage in or supervise the prevention, detection, investigation, or prosecution of any violation of law;
(2) the possession of a firearm or other dangerous weapon by a Federal official or a member of the Armed Forces if such possession is authorized by law; or
(3) the lawful carrying of firearms or other dangerous weapons in a Federal facility incident to hunting or other lawful purposes.