A man in a mental health crisis was apprehended Wednesday afternoon after an hourslong standoff with Forsyth County deputies.

The 36-year-old barricaded himself inside a townhome on Pierpoint Lane and fired a gun multiple times during the standoff, according to the Forsyth sheriff’s office. Neighboring townhomes were hit by the gunfire, but no one was reported injured.

Deputies were called to the Jamestown townhome community about 4:30 p.m. to investigate “unknown trouble,” sheriff’s spokeswoman Stacie Miller said in a news release. They encountered the man, who was “mentally distressed, intoxicated, threatening suicide, and was armed with a gun,” Miller said.

The Atlanta Journal-Constitution is not naming him because of his mental health status.

After attempting to negotiate his surrender, a SWAT team fired a foam projectile round when the man came out of the house holding a gun, Miller said. The sheriff’s office lifted a lockdown in the subdivision about 7:15 p.m. once he was taken into custody.

Sheriff Ron Freeman commended the crisis negotiation and SWAT teams for their efforts to resolve the situation without serious injury.

“Their exceptional de-escalation tactics without a doubt saved a life. The apprehension was both dangerous and difficult,” he said in a statement. “To accomplish this with only a minor injury proves their professionalism and dedication.”

The man was taken to Northside Hospital Forsyth for evaluation and released. He was arrested on charges of aggravated assault with a firearm.