PERTH AMBOY, N.J. (CBSNewYork) – A police officer in New Jersey is being credited with saving a life after a man on railroad tracks who was unaware an oncoming train was about to hit him.

Perth Amboy officer Kyle L. Savoia’s body camera recorded him racing to intercept a man in a red shirt laying face down on the tracks, unaware of a train barreling towards him last week.

READ MORE: Food Delivery Driver Shot And Killed While Sitting In Car In Little Italy

Savoia waved to stop the train while shouting at the dazed man, who got up and jumped out of the way at the last moment as the train rolled to an abrupt stop.

“Where’d you come from?” the man says afterwards. “Thank you, oh my God, thank you so much.”

The 22-year-old Savoia was dispatched for a welfare check at the Perth Amboy station Thursday around 8 a.m. The officer says when he got the call he knew there’d be a man on the tracks, but he didn’t realized there would be an oncoming train. Once he saw it bearing down, he knew he’d have to act fast.

“In a split second I decided to start running,” he told CBS2. “In that situation, your training takes over.”

READ MORE: Dog Scares Off Attempted Carjacker In Old Town

It turns out he man was homeless, and after being taken to Raritan Bay Medical Center treatment he showed up at police headquarters to thank Savoia again.

“He said I’m a true hero to him,” Savoia said. “That he had a two-year-old, that he had a family to go home to.”

Savoia lost his own father, a longtime sergeant with the Perth Amboy Police Department, just two years ago.

“What I thought of was his father, how proud his father would be in heaven looking down on his son,” Perth Amboy Chief Roman McKeon said.

MORE NEWS: Police Searching For Driver Wanted In Deadly Hit And Run Near Jefferson Park CTA Station

Ask Savoia, whose own career started only seven years ago, and he’ll tell you he was just doing his job.