Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Four people were killed and 40 others were hurt when a freight train hit a charter bus in Biloxi, Mississippi, on Tuesday, authorities said.

The accident happened shortly after 2 p.m. local time (3 p.m. ET). Forty-eight people were on the bus, which was was traveling from Austin, Texas, officials said. Forty people were transported to area hospitals, a spokesman for the city said. Eight people suffered critical injuries.

"It's a terrible, chaotic scene," Miller said. "We’re not sure about the bus itself, why it was stopped, if it was having engine problems or what," Police Chief John Miller said.

Senior groups from Bastrop and Lockhart in Texas were on the charter bus, which was heading from a casino in Bay St. Louis, Mississippi, to a casino in Biloxi when the accident occurred, family members told NBC affiliate KXAN in Austin.

The four people who died were two men and two women, the Harrison County Coroner's Office said.

Biloxi firefighters help passengers of a charter bus out after the bus collided with a train in Biloxi on Tuesday afternoon. Sun Herald

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

A witness described hearing the train continuously blow its whistle before it struck the bus — normally trains give two short horn warnings. The impact threw people from the bus, David Mc Donald, who works at a nearby car service shop, told NBC News.

"Bodies come flying out of the bus, they went over the top of the bus, under the bus, under the train ... I mean, it's just horrific," Mc Donald said in a phone interview. "I just thank the Lord that as many people that was on that bus, that the amount of survivors that there are," he said.

The bus was on the tracks at Main Street when it was struck by the eastbound train, Miller said.

The private charter bus was carrying people from Hollywood Gulf Coast Casino in Bay St. Louis to the Boomtown Biloxi Casino, a casino company official said in a statement.

"Our thoughts and prayers are with the families of those who tragically lost their lives and all those affected by this accident," Ameet Patel, senior vice president of regional operations for casino owner Penn National Gaming, said.

The National Transportation Safety Board said it is sending a team to investigate the crash.

The crossing where the bus was struck is a "steep crossing" and signs are present warning of the potential danger, Biloxi Police Sgt. Jackie Rhodes said.

"We recommended that buses not use that particular crossing," Rhodes said.

Rescue personnel carry an injured passenger after a CSX freight train hit a charter bus in Biloxi, Mississippi, on March 7, 2017. John Fitzhugh / The Sun Herald via EPA

A Pepsi truck was struck by a train after becoming stuck on the tracks at a nearby crossing in January, the city said at the time. The driver in that case had time to get out before the vehicle was struck.

The train pushed the charter bus approximately 300 feet down the tracks, Biloxi city spokesman Vincent Creel told the Biloxi Sun Herald newspaper.

Witnesses told the newspaper the bus became stuck on the tracks.

"Maybe it was about 5 or 10 minutes before the train arrived at that intersection," Mark Robinson told the newspaper. "He was blowing his horn and doing all kinds of different things trying to get the bus off the tracks, but it got stuck."

A spokesman for railroad company CSX said the mixed freight train was traveling from New Orleans to Mobile, Alabama, and had three locomotives and 52 cars, 27 of which were loaded. No one on the train was hurt.

"Our thoughts are with all involved," CSX spokesman Gary Sease said. The bus is owned by Echo Transportation, authorities said. Echo Transportation President and CEO John Ferrari said the company was in touch with authorities.