An Illinois police officer was able to tackle a suicidal teenage girl just moments before she would have been hit by an approaching train, stunning body camera footage showed.

Waukegan police released footage Monday showing the moments leading up to the dramatic rescue.

In the video, no one appears to be in the area as the officers, searching for a suicidal teen, approach the train tracks -- but as soon as the crossing gates are activated by the approaching train, a young woman comes out from behind the railroad mechanical shed.

After the girl disobeyed officers' commands to stop, one of the cops jumps into action, tackling the 17-year-old girl before she could step in front of the train.

“I am extremely proud of these officers who, through their heroic actions, saved the life of a young woman,” Chief Wayne Walles said in a statement.

Officials said they received a call Friday at about 1:40 a.m. from a woman who said her teenage sister was going to take her own life by standing in front of an oncoming train. Dispatchers were able to locate the girl by “pinging” her cellphone.

“I am just so proud of our dispatch who utilized their resources to locate the area where this young woman was and directed the responding officers to find her,” Walles said.

AS DOCTORS TAPER OR END OPIOID PRESCRIPTIONS, MANY PATIENTS DRIVEN TO DESPAIR, SUICIDE

Police said the girl was taken to the hospital for a psychiatric evaluation.

Joe Florip, a spokesman for the Waukegan Police Department, told the Chicago Tribune they released the photo because they recognize mental health is a huge issue.

“We thought this might be a huge catalyst for people who need help to get some help,” he said. "That’s why we included the suicide hotline number in the press release.”

He added: “We are also very proud of our police and dispatchers for the work they do on a daily basis. Sometimes the public doesn’t realize these are the type of things they are asked to do.”