The assailants then threatened the train's crew and opened some of the freight containers it was carrying.
A statement by the prosecutor's office did not specify what the gang stole from the train, operated by Kansas City Southern, a subsidiary of the U.S.-based railway company.
But the thieves may have been after drums of pseudoephedrine, a chemical used in the illegal manufacture of methamphetamines, according to an official at the Michoacan state attorney general's office. The official spoke on condition of anonymity because he was not authorized to be quoted by name.
The train was carrying imported merchandise from the Pacific coast port of Lazaro Cardenas.
Mexico, which does not make pseudoephedrine, imported it in large amounts in the past. The government has since banned almost all legal imports of the chemical, however, although illicit shipments remain a problem.
Also Saturday, prosecutors in the northwestern state of Sinaloa reported that at least four people were killed in a gunbattle between suspected drug traffickers in a remote mountain area.
The running battle apparently started on Christmas eve and continued for some time in the drug-plagued region known as "the Golden Triangle," near the border with Durango state, assistant state prosecutor Ramon Rodrigo Castro said.
Police using helicopters rescued two men wounded in the confrontation in the largely roadless area. But when the injured men were being transferred later by land to a hospital, about 30 masked gunmen intercepted the ambulance and abducted the victims.
Rodrigo Castro said he thought more bodies were likely to be found.
In other criminal matters, a judge ordered 23 suspected drug traffickers and local police officers held under house arrest after they were detained Tuesday with guns, drugs and cash at a cockfight in Zihuatanejo, a Pacific coast beach town, prosecutors said Saturday. The police officers allegedly were protecting the traffickers.
MORE L.A. BREAKING NEWS, WEATHER, TRAFFIC, SPORTS
SEND TIP || REPORT TYPO || TWEET @abc7 || WIDGET