Updated

Hundreds of Central Americans riding atop a cargo train in hopes of getting to the United States were being threatened and extorted by armed men before the train derailed and killed at least six, survivors told The Associated Press.

Many who had sneaked onto the roof of the train known as "The Beast" were thrown loose when eight of its 12 cars derailed as it hauled tons of metal junk through a remote, swampy stretch of southern Mexico, witnesses said. At least some of the dead were trapped because they had tied themselves to the train to avoid slipping as they rode between cars.

Witness accounts offered a close-up look at the horrifying conditions faced by the tens of thousands of Central Americans who cross Mexico in increasing numbers in hopes of finding work in the U.S., even as Mexican migration slows. Gangs of armed men prowl the train line, robbing, kidnapping, extorting and raping those trying to cross Mexico.

Hundreds squeeze together atop the train. Others ride between cars for lack of space, or to obtain shelter from the rain and wind.

"Those are the ones who died," Jose Hector Alfonso Pacheco, a 48-year-old Honduras, told The Associated Press in a shelter where Mexican authorities were housing dozens of the estimated 250 who had been riding on the train. Rescue workers were moving tons of wreckage and junk with heavy equipment Monday and expected to find more bodies, though not in the massive numbers first feared after the accident. At least five migrants suffered grave injuries, with dozens of others less seriously hurt.

Mexican authorities said the accident victims could stay in Mexico legally for a year and apply for citizenship if they wanted.

The dead migrants were between 19 and 58 years old. In an indication of why the toll wasn't higher, authorities said the train was crawling at about 2 miles an hour when it derailed.

Surviving migrants described themselves as having been kidnapped by armed men who had been taking them to meet with their chief in the nearby city of Coatzacoalcos, presumably to arrange the payments that would allow them to get across Mexico and into the U.S.

Agustin Sorto Ayala, a 22-year-old Honduran migrant, said he saw seven men get on the last car near the town of Chontalpa and move from car to car with flashlights and pistols, saying "we had to pay for a 'guide,' we had to pay 'rent' and if we didn't they wouldn't let us get off the train."

"They had us kidnapped and when the train derailed, that's how we got loose," he said.

Mexican officials said they were investigating the cause of the crash. State authorities have pointed to heavy rains softening the ground beneath the tracks, as well as potential pilfering of metal from the tracks.

The U.N. High Commissioner for Human Rights said the accident was a reminder of the dire conditions faced by migrants on the train.

Honduran and Guatemalan diplomats traveled to the area to help identify victims and make sure the injured were getting needed medical attention, the nations' foreign officials said.