The train derailed near Sidi Bouknadel, a town near Rabat, on the busy coastal line connecting the capital to the commercial hub of Casablanca.
The cause of the accident was not immediately clear.
A Reuters reporter at the site saw a train derailed near some industrial and residential buildings.