Mexican troops have rescued 165 people, mostly Central Americans including children and pregnant women, who were kidnapped by a gunman in Mexico's northeast and held captive less than a mile from the U.S. border, the government said on Thursday.

The group of would-be immigrants, primarily from El Salvador, Guatemala and Honduras, had hoped to cross into the United States from the volatile northern state of Tamaulipas.

They were captured in batches near the border two to three weeks ago and held in a house in the municipality of Gustavo Diaz Ordaz.

There was also an Indian national among the group.

"Everything indicates that these migrants were contacted by human traffickers ... and these criminals handed them over to criminal gangs instead of taking them to the border," government security spokesman Eduardo Sanchez said.

"They were found kidnapped by an armed individual and held against their will in precarious, dirty, overcrowded conditions," he added. The group was rescued on Tuesday.

Tamaulipas has been plagued by kidnappings and violence in recent years, and it has long been the site of a turf war between two major drug cartels.

In 2010, Mexican Marines found 72 corpses in a ranch near the border in the same state, thought to be the remains of migrant workers.

Get the Monitor Stories you care about delivered to your inbox. By signing up, you agree to our Privacy Policy

It was the biggest single discovery of its kind during a bloody drug war that has killed an estimated nearly 75,000 people since 2006.

Mexican cartels have moved into human smuggling in recent years, kidnapping migrants and extorting money from them or forcing them to carry drugs across the border. (Editing by Eric Beech)