Follow KDKA-TV: Facebook | Twitter

PITTSBURGH (KDKA) — A man was arrested Friday after he tried to bring a fully loaded firearm into the Allegheny County Courthouse.

READ MORE: Local Groups Team Up To Honor Single Mothers For Mother's Day

The Allegheny County Sheriff’s Office says 40-year-old Birch Foley, of Butler, Pa., was scheduled to appear in court on charges of retail theft and prohibited offensive weapon.

(Photo Credit: Allegheny County Sheriff’s Office)

Foley tried to enter the courthouse at the Grant Street entrance around 10 a.m. to attend his hearing. He tried to pass through the magnetometer multiple times, which alerted guards.

Officials say Foley denied having metal on his person, but the machine continued to go off. A guard asked Foley to step aside and manually scanned him with a handheld metal detector, which went off when it was placed near Foley’s ankle.

The guard lifted Foley’s pant leg and found a fully loaded Taurus .45 caliber semi-automatic pistol.

READ MORE: West Virginia Technical Center Students Build Tiny House

The pistol was secured and Foley was taken into custody.

Sheriff’s deputies who spoke to Foley believed he was under the influence. Foley initially denied these accusations, but eventually said he had taken methadone and oxycontin before he arrived at the courthouse.

Deputies confiscated Foley’s license to carry firearms and Foley’s bond was revoked.

Foley was sent to the Allegheny County Jail and is facing charges of possession of a firearm in a court facility and disorderly conduct.

MORE NEWS: Moon Twp. Garden Club Gives Away Plants For Victory Garden Initiative

He is also scheduled to appear in court in December on a separate case with pending charges of simple assault and strangulation.