The shooting happened around 3 p.m. Tuesday.
A witness said the shooter drove by, firing several shots toward the building. Authorities said the shooter was driving a white Dodge Durango.
Around 4:15 p.m., a Wake County Sheriff's Office spokesperson said a person had been taken into custody in Cary. Willie Lee Hayes Jr. was arrested without incident.
Wednesday morning, Hayes appeared in front of a judge and faces charges including attempted murder, second-degree kidnapping, discharging a firearm into an occupied property and one count of possession of a firearm by a felon.
During his appearance, it was announced Hayes is being held under a secured bond of $2,050,000.
Whiskey Kitchen owner Michael Thor said he heard around five muffled gunshots Tuesday.
"It's quite surprising, you don't expect it--not on a Tuesday at 3 p.m.," said Thor. "It's surprising."
Tim Bean was trying to find a parking spot in downtown Raleigh when he heard the shots.
"It sounded like gunfire but I didn't think anyone would be crazy enough to shoot in a populated, right at the courthouse," said Bean. "Who in their right mind is going to shoot a firearm in the city limits at the courthouse, that's crazy."
Photos posted to the Wake County Sheriff's Office Facebook page showed broken windows at the Public Safety Center, which houses the detention center, Emergency Medical Services (EMS), Fire/Rescue, the City-County Bureau of Identification and the Wake County Sheriff's Office.
"We went through the shock of having our Public Safety center shot up from the street. We had citizens out front standing by to go through the process to obtain pistol permits," Wake County Sheriff Gerald Baker said. "We had officers out there assisting them. I thank God not a single person got hit. All were in the line of fire."
Wake County Sheriff's Office said one deputy was cut by flying debris, but the injury was minor.
Traffic was blocked on Salisbury Street between Davie and Martin streets.
#BreakingNews Large police presence in downtown Raleigh outside Wake Co Justice Center on Salisbury St.— @AmberRupinta (ABC11 (@RupintaABC11) October 6, 2020
An Eyewitness telling #ABC11 he witnessed a drive by shooting. Salisbury St is blocked off with police tape as the investigation begins. The latest starting at 4 on #ABC11 pic.twitter.com/B4JZqK5LHf
Officials said they don't have a motive at this time.