CHICAGO (STMW) — An Uber driver put his concealed carry permit to use Friday night when he pulled a handgun and opened fire on a man he saw firing a pistol into a group of people on a Logan Square sidewalk, according to prosecutors.

Six blasts from his handgun injured a 22-year-old man identified as Everardo Custodio.

Custodio suffered wounds to his shin, knee and lower back and was still in Advocate Illinois Masonic Medical Center on Sunday, when Cook County Judge Peggy Chiampas refused to grant bail on charges of aggravated battery with a firearm and illegal possession of a firearm.

The 47-year-old Uber driver “was acting in self-defense and in the defense of others,” Assistant State’s Attorney Barry Quinn said.

Custodio, who lives about a block from the site of the shooting, was the only person injured in the confrontation that happened about 11:50 p.m. in the 2900 block of North Milwaukee Avenue.

The Uber driver had dropped off a passenger minutes before the shooting occurred, said Uber spokeswoman Jen Mullin. She had no comment on the driver’s actions other than to say the company requires all its drivers to abide by local, state and federal laws pertaining to transporting firearms in vehicles.

Quinn said the Uber driver, who could not be reached Sunday, was parked in his car when Custodio began firing in his direction, aiming at the nearby group of people.

Police patrolling the area heard the shots and arrived to find Custodio on the ground and bleeding. Police also recovered a handgun found near Custodio, Quinn said.

Uber plans to interview the driver and the passenger he dropped off before the shooting, said Mullin, who did not know where the driver stowed his handgun.

The driver was still an active driver for Uber as of Sunday night, Mullin said.

(Source: Sun-Times Media Wire © Chicago Sun-Times 2015. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)