Kevin Hart’s car veered off-road and ended up in a ditch in the Malibu Hills leaving the comedian and 2 other people trapped in the vehicle.

The accident happened just before 1 AM Sunday on the winding and treacherous Mulholland Highway. Crash scene video, obtained by TMZ, shows Kevin’s Plymouth Barracuda deep in a gully about 10 feet off the road. The car smashed through wooden fencing along the roadside, and you can see the roof was completely crushed by the impact.

Cops have confirmed the vehicle belongs to Kevin, but they tell us he was not driving at the time of the accident. There were 2 other people were in the car, including the driver — and cops say Kevin and the driver both suffered “major back injuries.”

The third person is a woman who did not require hospital treatment. Police say the driver had not been drinking.

Kevin was first out of the vehicle and according to a witness, a member of his security team showed up in an SUV and picked him up. Kevin lives nearby and cops say he went home “to get medical attention.” He was eventually treated at a hospital

Earlier, on Saturday … Kevin posted a video of himself in his vintage ride, as someone yelled at him for laying down too much rubber on the street as he spun out his tires.

Kevin bought the car back in July as a 40th birthday gift to himself.

This could’ve been a LOT worse. Prayers up for everyone involved.