At least seven people died and nearly 80 were injured after a shuttle train linking the Moroccan capital to a town farther north on the Atlantic coast derailed Tuesday, authorities at the accident site said.

The train derailed about halfway between Rabat and the town of Kenitra, near the city of Sale. Tangled in the wreckage were doors and seats that had been gouged out of place, while passengers' belongings and glass from broken windows littered the accident site.

More Images
A man searches a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

At least seven people died and nearly 80 were injured after a shuttle train linking the Moroccan capital to a town farther north on the Atlantic coast derailed Tuesday, authorities at the accident site said.

People gather after a train derailed Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Local residents were the first to reach the scene in the town of Sidi Bouknadel, helping injured or trapped survivors out of mangled train cars and covering the bodies of the dead. They reported the accident happened at around 9:30 a.m.

Workers gather by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

The general director of state-owned railway company ONCF, Mohamed Rabie Khlie, and Morocco's interior and transport ministers visited the accident site briefly, but refused to comment.

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officers and rail workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officers and rail workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Emergency workers rushed people to hospitals in Rabat, Sale and Kenitra while rescue teams searched for more victims with the help of cadaver dogs. Military personnel guarded the site as railway workers and authorities started to investigate why the train jumped its tracks.

A man searches a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

A man searches a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Local residents were the first to reach the scene in the town of Sidi Bouknadel, helping injured or trapped survivors out of mangled train cars and covering the bodies of the dead. They reported the accident happened at around 9:30 a.m.

"We heard a gigantic explosion. The earth shook and the sound was unbearable," Mourad El Kbiri, who owns a cafe near where the train detailed, told The Associated Press. "I rushed to see what happened. It was horrific. Disfigured bodies all over the place, blood and body pieces."

The Center for Blood Immunization declared a state of emergency and dispatched blood collection vehicles to Rabat, Kenitra, Sale and Sidi Bouknadel to receive donors.

People gather after a train derailed Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

People gather after a train derailed Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

The general director of state-owned railway company ONCF, Mohamed Rabie Khlie, and Morocco's interior and transport ministers visited the accident site briefly, but refused to comment.

The Moroccan king, Mohammed VI, offered to pay the costs of victims' funerals out of his own pocket, state news agency MAP reported.

Workers gather by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Workers gather by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Train employees stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officer and train workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officers and rail workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)

Police officers and rail workers stand by a derailed train Tuesday Oct.16, 2018 near Sidi Bouknadel, Morocco. A shuttle train linking the Moroccan capital Rabat to a town further north on the Atlantic coast derailed Tuesday, killing several people and injuring dozens, Moroccan authorities and the state news agency said. (AP PhotoAbdeljalil Bounhar)