Authorities say 158 local police officers have been detained in northern Mexico for alleged ties to organised crime - forcing the army and state police to fill the security void, prosecutors say.

Durango state prosecutors say the officers worked in the Durango cities of Gomez Palacio and Lerdo. They say soldiers and state police officers will patrol the cities.

They said in a statement on Friday that investigators found evidence the police officers were protecting and sharing information with drug traffickers for at least the past three years.

The army and state police had to take over security in both towns since the remaining municipal officers will undergo training and background checks to ensure that "links with criminal groups are eradicated", the office of Sonia de la Garza Fragoso, Durango state attorney general, said in a statement.

Prosecutors say detained suspects told investigators some of the officers worked for the Sinaloa drug cartel.

The purge highlights the often cozy relationship between local police and drug cartels in Mexico, a country plagued by drug-related violence that has left more than 70,000 dead since 2006.

The powerful Sinaloa cartel controls drug trafficking in mountainous state of Durango, which has endured a bout of violence in recent months.

Homicides there have more than doubled over the past two years amid a turf war between the Sinaloa and Zetas cartels.

The detained officers "are part of a structure within organised crime", de la Garza told local radio, adding that some of the officers took part in kidnappings.

Authorities have already stripped the municipal officers of their weapons to investigate their possible use in crimes.

Some detained officers told investigators that a gang launched a wave of robberies in the towns last week in a ruse to make residents put pressure on authorities to return the guns to the municipal cops, de la Garza said.

Authorities had already fired 145 Gomez Palacio officers in November after they failed vetting tests.