John Fancher / Reuters
A suspect later identified by police as Andrew Joseph Dennehy holds a gun as Tulsa County sheriff's deputies and other law enforcement officers surround him on the plaza in front of the Tulsa County courthouse in Tulsa, Oklahoma, on Wednesday.
By msnbc.com staff and news services
A 23-year-old man was arrested Wednesday after he opened fire outside the Tulsa County Courthouse, police said. A sheriff's deputy and a bystander were injured.
Police said the man, identified as Andrew Joseph Dennehy, walked into the plaza outside the courthouse and Tulsa City-County Library and began firing into the air. A deputy fired back, police said.
Tulsa County sheriff's Sgt. Shannon Clark said the incident occurred at 2:39 p.m. (3:39 p.m. ET), the Tulsa World newspaper reported.
Clark said a deputy was shot in both hands and both arms and was in surgery Wednesday evening. He didn't know the extent of the injuries to the deputy, whom the department didn't identify.
PhotoBlog: Suspect surrounded by police after Tulsa courthouse shooting
Tulsa Police spokesman Leland Ashley said the gunman, shot in the upper torso, was in critical condition, but the wounds sustained by the deputy and the male bystander were not life-threatening, Ashley said.
A woman, who was not hit by gunfire, was "shaken up" and treated at the scene.
Clark told NBC News on Wednesday that the suspect was in critical condition.
Police spokesman Leland Ashley said Dennehy was considered to be in police custody but hadn't been formally charged.
The sheriff's office told the local FOX23 station that their security procedure was carried out exactly as planned, and that the police officers reacted very quickly.
The courthouse was set to be open as usual Thursday, FOX23 reported.
'Everybody was running'
The Tulsa World reported that a wedding ceremony had just taken place in the plaza when the gunfire erupted.
John Fancher / Reuters
Tulsa County sheriff's deputies and other law enforcement officers secure a gunman on the plaza in front of the Tulsa County courthouse in Tulsa, Oklahoma, on Wednesday.
"The shooter was about 20 feet away from me," Angela Reudelhuger of tulsaweddingminister.com, who had conducted the ceremony, told the Tulsa World. She said the bride and groom's 6-month-old baby was among the wedding guests.
"We just jumped inside [the courthouse], and I yelled at the deputy, 'Somebody's shooting!'" she said.
Glyn Roe, a heating and air conditioning worker from Tulsa who was visiting the library Wednesday, said he saw all the events unfold.
"Everybody was running," Roe said. "I was watching it to make sure he wasn't coming into the library, or I would have started running, too."
Virginia Jones, owner of Downtown Tulsa Tag Agency, where people can update their car licenses, said she and her son were leaving to pick up another child from school when they heard gunfire.
Police officers crouched behind giant planters that dot the plaza when more gunfire erupted.
"It wasn't long after that that police just started coming from everywhere," she said.
More content from msnbc.com and NBC News
Follow US News on msnbc.com on Twitter and Facebook
Msnbc.com staff and The Associated Press contributed to this report.