A Midland County Sheriff’s deputy was injured after a freight train plowed into his SUV. His decision to drive around the lowered barriers was caught on video, showing him unaware there was a second train coming from the opposite direction.

After the crash, the deputy was taken to the hospital with bruising on multiple areas of his body, as well as pains in his neck and head, as reported by CBS7. Of course, the extent of his injuries could have been much worse.

“When I got the call that he had been hit by a train and there was head injuries, everything runs through your head,” said Sheriff Gary Painter, while adding that the deputy was responding to a call of an infant having breathing issues. “You just, you pray for the best, but you expect for the worst. And thank God he’s not hurt that bad.”

Also watch: Reckless Driver Ignores Barriers In Crossing, Gets Hit By Train

Painter went on to justify his deputy’s error stating that the accident happened “because they were in an emergency situation trying to get across. They had their red lighted and sirens on and they were trying to get across to help the family.”

Meanwhile, witness Mike Lopez found the whole incident shocking.

“I guess he just didn’t see the other train and the train just hit him head on. A couple more seconds and he would have been gone. Other than that, it was pretty crazy seeing it right here in front of us.”

“Lucky man,” he added. “Lucky somebody was watching over him. That’s crazy.”

As for the infant in distress, emergency responders were able to get there on time and take the baby to a hospital.