The train driver reported seeing several dozen people sitting on or near the track at about 10:30 pm on Thursday but was unable to stop in time, a local prosecutor said in a statement.
“The driver tried to alert them by horn and stop the train. Many managed to escape but 14 were killed,” the statement said, adding that the victims were from Afghanistan and Somalia.
The accident occurred on a part of railroad passing through a canyon in a mountainous area near the central town of Veles, so migrants could not get out of the away.
The bodies were taken to a chapel at the local cemetery in Veles, police said.
Eight migrants were detained, while others fled the scene, a police spokeswoman Anita Stojkovska said.
In the past six months around a dozen migrants had been killed in similar incidents on the same stretch of line, she said.
Refugees from impoverished and war-torn countries in Africa, the Middle East and central Asia walk through Macedonia along the line to reach Serbia as they head north from Greece in the hope of crossing the European Union border into Romania, Hungary and Croatia.
According to the latest report of EU border agency Frontex, Macedonian smugglers charge between 120 and 200 euros for passage as far as the Serbian border.
Similar networks have sprung up on the Greek-Albanian border, owing to greater security on ferry crossings between Greece and Italy.
Traffickers charge half the price for the land route through the western Balkans into northern Europe, around 1,800 euros compared to 3,000 euros for the direct sea or air route, according to Frontex.
Detections of non-EU migrants on the border between Serbia and Hungary rose by 338 percent between 2012 and 2013, according to Frontex.
The latest tragedy in Macedonia comes as EU leaders on Thursday agreed to triple the funding for the bloc’s search and rescue operation in the Mediterranean in a bid to curb the soaring number of migrants dying as they seek a better life in Europe.
More than 750 people died last weekend when a boat packed with migrants capsized and sank near Libya.
Already, more than 1,750 migrants have died crossing the Mediterranean this year — 30 times more than the same period in 2014. (AFP)