With a handgun pointed at him and his passengers, a man behind the wheel of a car in downtown St. Paul responded with his own gun and shot the perpetrator, authorities said Wednesday.

The gunfire occurred about 7:50 p.m. Tuesday in the Lowertown neighborhood.

The suspect, Kevin D. Ashford, 31, of St. Paul, was charged Wednesday in Ramsey County District Court with three counts of terroristic threats.

Police found Ashford with a gunshot wound to his chin and left collarbone. He was treated at Regions Hospital for noncritical injuries.

The driver holds a government-issued permit to carry a firearm, said police spokesman Steve Linders, adding that his name is being withheld “due to safety concerns.”

Police said robbery was a possible motive, a question the charges did not address.

According to the criminal complaint and police: The driver and two passengers were listening to music in the 300 block of Wacouta Street when two men approached. Ashford went to the passenger side and waved at a man in the front passenger seat. The driver rolled down the window so the two could talk.

The passenger recognized Ashford as someone who had been sending his wife “rude texts,” the complaint said. His wife was sitting in the back seat.

“Ashford pulled a gun out of a black sock and pointed it at [the driver],” the charges said. “Ashford then yelled at [the front seat passenger] and pointed the gun at [his] head.”

The driver pulled out his handgun and shot twice at Ashford, who fled on foot. Ashford’s companion also fled.

The driver drove a short distance and flagged down a Metro Transit police squad to report the shooting.

The driver and male passenger said they believed Ashford was going to kill them.

Ashford’s criminal record includes convictions for robbery, selling illicit drugs and disorderly conduct.