Saved in the nick of time.
A pilot on Sunday narrowly avoided being struck by a train after his aircraft crashed on the tracks near Whiteman Airport in Pacoima, California shortly after takeoff.
The pilot, who has not been identified by authorities, was involved in a small, single-engine airplane crash just after 2 p.m., the Los Angeles Fire Department said in their initial alert. He was the only occupant onboard.
Prior to the crash, the plane “lost power,” according to a social media post by the LAPD’s Operations-Valley Bureau.
However, within five minutes of the crash, the pilot faced another scary situation, according to the Associated Press: an incoming commuter train.
The plane crashed on a set of railroad tracks just blocks away from the Los Angeles Police Department’s Foothill Division station — and fortunately, officers were able to arrive on the scene almost immediately, according to the AP.
Bodycam footage released by the LAPD shows a group of officers pulling the bloodied pilot from the aircraft just seconds before the train strikes the plane on the tracks.
“Go, go, go!” a voice can be heard yelling as the officers drag the pilot to safety.
The LAPD publicly commended its officers for jumping into action to save the pilot’s life.
“Foothill Division Officers displayed heroism and quick action by saving the life of a pilot who made an emergency landing on the railroad tracks,” they wrote on Twitter.
Never miss a story — sign up for PEOPLE‘s free daily newsletter to stay up-to-date on the best of what PEOPLE has to offer, from juicy celebrity news to compelling human interest stories.
After being rescued, the pilot was transported by police to a regional trauma center, the LAPD said in an update on Sunday. Additional information about the pilot’s injuries were not released.
The crash will be investigated by the FAA and the National Transportation Safety Board, per CNN.