CHARLESTON, S.C. (WCBD) — The Charleston County Sheriff’s Office arrested one person on Wednesday after a car chase ended on the train tracks — with the driver barely getting out on time.

According to CCSO, a deputy tried to make a traffic stop at about 12:45 a.m. on Rivers Avenue, but the driver fled into Berkeley County.

The driver ran off of the road near Highway 52 and Liberty Hall Road, hit a railroad electrical box and then landed on the train tracks.

The driver got out of the car and ran just before the car was hit by an oncoming train.

Deputies searched the area, but couldn’t find the driver. They identified him as 38-year-old Marquise Tyrone Fogle.

Fogle later turned himself in. He was arrested on charges of failure to stop, driving under suspension and second-offense possession of marijuana.

The Amtrak was traveling from Sanford, Florida to Lorton, Virginia when it hit the unoccupied vehicle, according to a spokesperson.

They said 376 passengers were on the train. No injuries were reported to passengers or crew members. Amtrak is working with the Charleston County Sheriff’s Office to investigate the incident.