SUNNYVALE (KPIX 5) — A deputy patrolling the Caltrain tracks in Sunnyvale pulled a driver to safety after his car ended up on the tracks Monday evening, seconds before a train slammed into the vehicle.

Authorities told KPIX 5 that two deputies were patrolling the Caltrain rails at Mary Avenue in Sunyvale, when a driver crashed into the crossing arm and pole around 6:30 p.m. Authorities said the man appeared drunk.

READ MORE: San Francisco Sees 3,000 Car Break-Ins in 1 month; 'It's Out of Control' 

One of the deputies pulled the man out of the car, moments before it was hit by a northbound train.

ALSO READ: Dead Frog Reportedly Found In Bag Of Organic Spinach Leaves

“These deputies did not hesitate, they acted. Had they not acted, who knows what would have happened, I believe because of their actions, this person is alive today,” said Detective Salvador Zuno of the San Mateo County Sheriff’s Department, the agency that handles law enforcement on Caltrain.

While the deputy pulled the man to safety, Deputy Erick Rueppel ran onto the tracks toward the oncoming train to slow it down.

“I’m just happy at the result…Nobody died, that would be the worst outcome of this situation,” Rueppel said. “And I’m glad we were here.”

“These kinds of incidents aren’t just hard for the families of the victims, they’re hard for our engineers and crews on board the train so we’re so grateful that tragedy was averted because these two deputies were in the right place at the right time,”  said Caltrain spokesperson Jayme Ackemann.

READ MORE: At-Risk Veteran Missing In Alameda; Police Seek Public's Help

MORE: Lone Gray Wolf Spotted In Northern California

The deputy had been responding to a call nearby prior to the crash, Ackemann told Bay City News Service.

The crash could be seen in two YouTube videos.  The driver of the car can be seen being dragged away from the tracks by transit police before the first train struck the car.

The incident resulted in delays of up to 45 minutes as trains single-tracked through the area. Both tracks had reopened for service by 7:45 p.m., according to Ackemann.

Crews were repairing the broken crossing arm and pole as of late Monday night.

The sheriff’s department did not give the driver’s name, but said he was in his 20s and suffered minor injuries.

MORE NEWS: Afghan Refugee Who Moved Family To NorCal Shot Dead In San Francisco While Working As Driver

TM and © Copyright 2015 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2015 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. Bay City News Service contributed to this report.