The incident began around 11 a.m. at the Yardley Commons complex along the area of South Main Street.
Police say a probation officer had arrived to the location to check on Colin Petroziello. But the officer soon had to call Yardley police for assistance. Officials say it's not unusual for Chief Joe Kelly to respond to calls personally because it's such a small department.
At some point during the incident, Petroziello opened fire on Chief Kelly, according to investigators.
Lower Makefield Police Chief Ken Coluzzi said Kelly was hit by a shotgun blast that injured his hand and ear.
Chief Kelly was taken to St. Mary Medical Center where he was listed in good condition. Coluzzi said Kelley was "extremely lucky to be alive."
Meanwhile, a SWAT team surrounded the condominium complex to get Petroziello to surrender. Residents were told to shelter in place, motorists and pedestrians were urged to avoid the area.
The standoff ended late in the afternoon after SWAT teams used a flashbang to help bring Petroziello into custody.
"From what I understand, he was unconscious at the time we breached the door," said Bucks County District Attorney Matt Weintraub.
Only Action News was there as Petroziello was escorted before Magisterial Court Judge Joseph Falcone Wednesday night. He had nothing to say.
Petroziello is described in an affidavit of probable cause as a "person with a history of mental issues" and "one who poses a significant threat to the community."
He is being charged with attempted murder of a law enforcement officer.
Kelly has been the police chief in Yardley since 2015 and was an officer across the river in New Jersey prior to serving the Bucks County community. He is continuing his recovery in the hospital.
"The luckiest person today is Chief Joseph Kelly," said Weintraub.