An amazing video has been released showing a police officer dragging a driver to safety just seconds before the car he was in was hit by an oncoming train.

The amateur footage, posted online by YouTube user karin Lizana, shows a vehicle seemingly stuck on a level crossing in northern California. A San Mateo County Sheriff's deputy can then be seen pulling a man from the car and dragging him away from the tracks just moments before a double-decker California commuter train (Caltrain) smashes into the vehicle.

Local Sheriff's deputies Lance Whitted and Erik Rueppel were given credit for saving the man's life, after they came to the aid of the driver.

"If it had not been for the deputies being at the right place at the right time, the driver would have been significantly injured," San Mateo County Sheriff's spokesman Salvador Zuno said.

While the video shows only one train hitting the vehicle, two separate trains hit the car while it was on the tracks on 3 August, according to Caltrain. The incident is currently being investigated.