Peru's new president, Ollanta Humala, has replaced two-thirds of the country's most senior police officers in a purge designed to root out corruption in the force.

Thirty of Peru's 45 police generals have been pushed into retirement in a decree signed by Humala over the weekend, although some have alleged that it was not an anti-corruption move but an attempt to control the police. Security experts said a shakeup of this scale was unprecedented. Among those sacked was General Raul Becerra, the director and commander of the anti-drugs division, Dirandro, at a time when Peru comes close to rivalling Colombia, the world's number one cocaine producer, according to the United Nations Office on Drugs and Crime (UNODC).

"We must banish any act of corruption that stains the name of the police," said the force's new director, Raul Salazar, at his inauguration ceremony on Monday. "From the smallest to the most important. It does not matter if you steal one sol, or more," he said, referring to the Peruvian currency.

Recent opinion polls show most Peruvians questioned consider the police to be the most corrupt institution in the country. Humala, who took office at the end of July vowing to tackle corruption and social inequality, has a 65% approval rating according to the latest polls.

But critics have accused the president of acting hastily without giving officers the opportunity to defend themselves from corruption allegations. At least one police general said he had been sacked even though he had not been linked to any wrongdoing.

"This isn't an anti-corruption drive. It's a pretext to politically control the police," the security expert and former interior minister Fernando Rospigliosi said. "Some of those who have been sacked are not being investigated for corruption while some of those who remain are," he said. "This move is aimed at creating personal loyalty among the newly appointed police generals which will be harmful to the institution as a whole."

The vice-president, Omar Chehade, said the overhaul of the police hierarchy was the result of a "rigorous evaluation" by Humala and the ministers of interior and defence. But another former interior minister, Remigio Hernani, told Peru's RPP radio: "If indeed it's the case that there are generals with problems, not all of them are corrupt, not all of them are inept. Some are very respectable."

Peru had the highest perception of insecurity of any country in Latin America, beating even El Salvador and Brazil, even though the actual rates of violent crime in those countries are substantially higher, according to a survey carried out by the Latin American Public Opinion Project and published in late 2010. This perception of insecurity appeared to be strongly linked to the low credibility of the police force, which is widely viewed as ineffective and corrupt.

Meanwhile drug-trafficking has increased as Mexican cartels are supplied by the remnants of the Shining Path guerrilla group which grow and process the coca leaf into cocaine on the eastern slopes of the Peruvian Andes.

Peru is the world's second biggest producer of cocaine after Colombia. Its area under coca cultivation has grown steadily for four years to reach 61,200 hectares last year, according to the UNODC.

Yet Peru trails behind Colombia in drugs interdiction. Colombia's annual cocaine seizures have fluctuated around the level of 200 tonnes since 2008, while Peruvian authorities seized just over 40 tonnes in 2010, little more than one fifth of that amount.

Peru has recently boosted its national police force to tackle the rise in crime and drug trafficking, taking on 5,600 recruits this year to bring its overall numbers to about 104,000.