PERTH AMBOY, N.J. -- A police officer in New Jersey is being credited with saving the life of a man lying on tracks who was unaware an oncoming train was about to hit him, reports CBS New York. Perth Amboy officer Kyle L. Savoia's body camera recorded him racing to intercept a man in a red shirt lying face down on the tracks, not realizing a train was barreling toward him last week.

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."

Get Breaking News Delivered to Your Inbox

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 realize there would be an oncoming train.

Once he saw it bearing down, he knew he'd have to act fast.

Savoi's body cam video shows he went from jogging to sprinting. "In a split second, I decided to start running," he told CBS New York. "In that situation, your training takes over."

It turns out the man was homeless and, after being taken to Raritan Bay Medical Center for 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."

Perth Amboy officer Kyle L. Savoia and man whose life he's credited with saving, shortly after the July 2018 incident CBS New York

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.

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