The incident happened around 3:58 p.m. at the courthouse in Woodstock.
The suspect was stopped by security officers as he attempted to enter the building. He fled and was chased by the officers.
The person was arrested nearby and a weapon was recovered, police said.
No further information was immediately available as McHenry County officials continue to investigate.