A cargo train transporting wheat to Uganda on Sunday derailed at Makupa Causeway near Kibarani in Mombasa County.
Rescue engine, police officers were called to action to prevent the locals from looting the wheat.
They were at some point forced to shoot in the air to keep the crowds away.
Two of the 19 wagons fell into the ocean while others were trapped by mangrove trees.
Some of the locals blamed lack of maintenance of the rail for the accident.
“Just look at this line and you can tell when it was last maintained to hold a train,” said one of the locals, as quoted by the Nation.
A rescue engine was later deployed to the scene to help in retrieving the wagons and getting them back on rail.