Three teen males allegedly attack man on bus after midnight. But victim has license to carry gun — and brings the pain.

A 24-year-old man told Philadelphia police that three teen males attacked him aboard a bus around 1 a.m. Thursday, after which the victim pulled out a gun and opened fire on the trio, WCAU-TV reported.

The Southeastern Pennsylvania Transportation Authority bus pulled over at Bustleton Avenue and St. Vincent Street after the males — ages 17, 16, and 15 — were shot in their legs, police told the station.

The teens were rushed to hospitals for treatment and listed in stable condition, WCAU reported.

Three other people on the bus and the driver were not hurt, the station said.

‘At least three shots’

The man remained at the scene and told officers he pulled the trigger in self-defense after being attacked, WCAU said.

“Preliminary information is that 24-year-old male who was being physically attacked did pull a handgun and fire at least three shots,” Philadelphia Police Chief Inspector Scott Small told KYW-TV.

Police added to KYW that the man has a license to carry and was cooperating with investigators.

In addition, he was taken in for questioning and wasn’t charged as of Thursday morning, KYW said, adding that his gun was recovered.

Bus surveillance cameras could help detectives in the investigation, KYW added.

*story by The Blaze