The entire municipal police force in the coastal Mexican resort of Acapulco is under investigation amid suspicions of infiltration by criminal groups.
Marines surrounded the police headquarters and disarmed 700 officers.
Federal police and the military will now patrol the city instead.
Acapulco became famous as a destination for the rich and famous in the 1950s and 1960s but has since become a hotspot for drug trafficking and has a high murder rate.
Marines, state and federal police were deployed in a massive operation on Tuesday. They surrounded Acapulco's municipal police headquarters and formed a security cordon around the building.
They then moved into the headquarters and disarmed hundreds of officers and seized their ammunition, bulletproof vests and radios.
They also arrested two police commanders on suspicion of murder. The chief of Acapulco's highway police was also detained after he was found to be carrying unlicensed weapons.
The entire municipal police force and its chief, Max Lorenzo Sedano, are under investigation. All officers will undergo a "confidence test" and will be questioned about possible links to criminal gangs.
Meanwhile, their equipment and weapons will be placed under lock and key.
Policing would be carried out by state police until the investigations are concluded, a Guerrero state official said.
How bad was the situation?
The raid came after state officials noticed an increase in crime in Acapulco and "a lack of action by the police to deal with it".
Last year, the homicide rate in the city rose to 106 murders per 100,000 inhabitants, one of the highest in the world. London by comparison had a rate of 1.45 murders per 100,000 people between September 2016 and September 2017.
Locals in Acapulco have complained about the rise in violence, with clowns marching in protest in May saying they were losing business because people were too afraid to throw parties and paramedics warning that they were struggling to deal with the effects of the violence.
In January, the US state department prohibited US government employees from travelling to Acapulco and surrounding Guerrero state.
In July, bakery products firm Bimbo stopped delivering to parts of Acapulco because of the rise in violence.
Local media have pointed out that the operation comes just five days before a new mayor takes office in Acapulco.
The mayor-elect, Adela Román from the left-wing Morena party, said last week that her pick for security chief had received death threats.
The future security chief, Leticia Castro Ortiz, was reportedly told she would be "met by bullets" if she took up the position.
Mayor-elect Román insisted that despite the threats she would put "new officials in power, these posts are not forever (…) often officials hold on to them as if it was their birthright".
She also said that she would reorganise the municipal police force and officers would be trained in human rights.
What's the situation in the rest of Mexico?
Acapulco is one of the most violence-stricken cities in Mexico and is located in a state which has been badly affected by drug-related violence.
And while many parts of Mexico remain largely peaceful, the murder rate nationwide reached a record level last year.
Municipal police forces are seen as the weakest link in Mexico's security system. Poorly trained and badly paid, they can easily be threatened or cajoled into colluding with local drug gangs.
Federal police and soldiers have taken over policing duties in some crime hotspots before but the move has failed to drive down crime for good.
Human rights groups have also warned that while marines and soldiers have had success in arresting top drug dealers, they are not trained for policing duties and can be heavy handed when dealing with civilians.