A Philadelphia police officer was pulled from his vehicle moments before it erupted in flames after the car crashed during an investigation of a possible shooting on Thursday.

Officer Matthew Smyth had heard gunshots while on patrol in North Philadelphia and attempted to respond when he collided with a bridge support, FOX29 reported.

Other officers soon arrived to aid the 31-year-old, who had suffered cervical spine and hip fractures and was stuck in the vehicle.

Alex Ruffin, who recorded video of the incident, told WPVI-TV that he heard the impact and saw "smoke and lights and everything" as he ran to the scene.

CLICK HERE TO GET THE FOX NEWS APP

The cruiser caught fire a short time later.

"Yo, the car is on fire! Get him out! Get him out!" someone can be heard yelling in the video.

SEVERAL INJURED AT MARYLAND AIRPORT AMID ‘PARTIAL EQUIPMENT FAILURE INVOLVING JET BRIDGE,’ OFFICIALS SAY

Officers were able to free the officer before the car exploded, and no other injuries were reported.

Smyth repeatedly asked for something to drink, according to Ruffin.

"He was semi-conscious. He was doing a lot of moaning," he told WPVI. "He had a gash in his head. He was asking people for a cup of water, a bottle of water."

Family members told WPVI the nine-year veteran of the department remains hospitalized, but is not facing paralysis. The cause of the crash remains under investigation.