(CNN) With only seconds to go before a train barreled through, a Utah state trooper pulled an unconscious driver from his car after it got stuck on the tracks.

Trooper Ruben Correa, who has been with the Utah Highway Patrol for two years, was responding to a routine traffic stop when he got a call from dispatch about a car on train tracks not far from him, according to Sgt. Nick Street, the spokesman for the Utah Highway Patrol.

The driver of the car, a man in his 20s, was unconscious, and a medical issue contributed to him driving off the nearby highway and onto the tracks, said Street.

The Utah Highway Patrol released images of how the car looked after it was struck.

Correa left the traffic stop and began to drive down the freeway using his spotlight to search for the vehicle, Street told CNN.

He ended up arriving in the nick of time. It took 35 seconds from when Correa got out of his patrol car to when the train hit the stranded vehicle, said Street.

Read More