An off-duty correctional officer traded gunfire with a would-be carjacker who threw her to the ground at a gas station in Philadelphia on Tuesday night, authorities said.

The 35-year-old female victim was pumping gas for her 2018 black BMW just after 10:30 p.m. in North Philadelphia when the 22-year-old Black male suspect approached her at gunpoint and demanded her keys, the Philadelphia Police Department said.

The suspect then grabbed the victim in "a bear hug" from behind, and a struggle ensued, Philadelphia Chief Inspector Scott Small told FOX29 Philadelphia.

Police said the suspect pulled the victim from the car and brought her to the ground.

CONCEALED CARRY HOLDER FLIPS THE SCRIPT DURING ATTEMPTING CARJACKING, SHOOTS SUSPECT AND ACCOMPLICE

gas station where shootout occurred

The 22-year-old male suspect tried to carjack the victim at a gas station in North Philadelphia on Tuesday night, authorities said. (FOX29 Philadelphia WTXF)

The victim then drew her own handgun, and the pair started shooting at each other, according to authorities.

evidence markers on ground

The suspect and victim, a 35-year-old off-duty correctional officer, each drew their own guns and traded shots, authorities said. (FOX29 Philadelphia WTXF)

Officers on patrol heard the gunshots and rushed to the gas station, where they found the suspect lying on the ground with multiple gunshot wounds. A handgun was recovered from underneath him.

The victim was found inside the gas station with at least one gunshot wound.

officers investigating gas station scene

Police said both the suspect and victim suffered gunshot wounds and are in stable condition at a hospital. (FOX29 Philadelphia WTXF)

DC POLICE ARREST BOY, 12, FOLLOWING ARMED CARJACKING IN BROAD DAYLIGHT: ‘IT’S GOTTEN SO BAD'

Both the victim and the suspect were rushed to a local hospital in stable condition.

Police told the station that officers had detained the suspect at the hospital.

CLICK TO GET THE FOX NEWS APP

No additional details were immediately available as police continue to investigate the shooting.