The police official said the man appeared to have some sort of medical condition.

A quick-thinking Utah police officer pulled an unconscious driver out of the path of a train seconds before it smashed into the man's vehicle.

A dramatic dashcam video posted by the Utah Highway Patrol on their Twitter account Wednesday showed Trooper Ruben Correa with his torch scrambling up an embankment in the dark as the train speeds towards a car parked on the tracks.

"It looks like the vehicle's on top of the tracks," Correa said into his radio as he reached the car with the train bearing down on them, its headlight shining.

"Let's go! Get out of here! We've got a train coming! We've got a train coming! We've got a train coming," he yelled at the man as the train sounds its horn.

Correa pulled the man free just seconds before the train hits the car, and two rolled down the embankment. The train then stopped.

The trooper was responding to a call about a car on the tracks early Wednesday in Centerville, Utah, when he heard the train coming.

"I heard the horn from a train, I looked to my left and I was able to observe that train was coming pretty fast, anywhere between 50 and 80 miles an hour," Correa told ABC4.

"At that point I was a little bit concerned about that... At that point I wasn't really thinking, I was just doing my job and the main concern was getting him out."

Check out the amazing life-saving work by Trp. Correa this morning! pic.twitter.com/O6du6AN9Oo — Utah Highway Patrol (@UTHighwayPatrol) October 16, 2019

He said the man appeared to have some sort of medical condition.

"He was in danger and I had to get him out of the vehicle as quickly as possible," he Correa said.

"I got worried after I saw the train hit the vehicle and the vehicle flew about 30 feet in front of us and that's when I realized 'Oh wow. That was a lot closer than what I would have liked'."

The video from his dashcam has already been viewed more than 250,000 times.

Correa told ABC4 he had spoken to the young man afterwards.

"I'm just very grateful that I was able to get him out and he's alive and he's back with his family now."