A rookie police officer saved a despondent man from being hit by a commuter train by running down the tracks and screaming “Hey, Bud! Hey, move!” and “Stop the train!”

Perth Amboy patrolman Kyle Savoia’s body camera video captured the moment last Thursday.

The man got off the tracks with moments to spare before the train stopped. Two other officers had notified New Jersey Transit to slow the train.

Savoia, who has been on the force for just seven months, told the man, who appeared distressed, to sit down. The man asked the officer where he came from and then repeatedly thanked him.

The man’s name has not been released, and it is not known why he was sitting on the tracks. Authorities say the man was taken to a hospital for further treatment.

“As police officers, our job is to make quick decisions in difficult situations and to act on them,” Savoia said. “At the end of the day, all that matters is everyone gets home safe. Also, at such an early stage of my career, to be able to make an impactful difference in a person’s life is incredible and makes me love what I do every day.”

Savoia and his brother, Kevin Savoia Jr, were both sworn in as Perth Amboy officers in January. The officer’s late father, Sgt Kevin Savoia Sr, served on the Perth Amboy force for more than 28 years.