President Ollanta Humala replaced his prime minister on Saturday with a former army officer who was his instructor in the military in an unexpected Cabinet shake-up that stunned Peru.

Oscar Valdes, who until now had been Humala's interior minister, will replace Salomon Lerner, a businessman who was the most powerful centrist in the government and had helped Humala shed his left-wing image to win election in June.

A government source said Humala, who was a professional soldier before he turned to politics, asked Lerner to quit to allow him to build more cohesion in his ideologically diverse cabinet.

Political analysts said the Cabinet shuffle showed Humala would adopt a more authoritarian style but likely leave intact the country's free-market economic model, which depends heavily on foreign investment in the mining and oil sectors.

Today the president has become an authoritarian strongman, and this is bad, said Cesar Hildebrandt, a prominent political analyst and columnist.

Humala declared a state of emergency last week in the region of Cajamarca, giving the police and army special powers to quash an environmental protest against a proposed $4.8 billion (3.0 billion pounds) gold mine he says would create thousands of jobs.

This confirms the economic model will endure and be prolonged, it's a step sectors on the right will applaud, Hildebrandt said.

The crackdown in Cajamarca was reportedly urged by Valdes to halt a growing wave of protests.

Hundreds of disputes nationwide have threatened to delay $50 billion in planned mining and oil projects that would fuel economic growth for years but have angered rural communities worried about pollution and losing control of scarce water supplies.

By relying on force after weeks of negotiations with community leaders in Cajamarca failed, Humala indicated he was willing to impose change, Hildebrandt said. The Conga project in Cajamarca, by U.S.-based Newmont Mining, would be the biggest investment in Peruvian mining history.

PATTERN OF ABRUPT CHANGES IN STYLE

Opposition lawmakers criticized Lerner's departure as premature and worried Humala might have been pressured by leftists in his party to purge moderates from his Cabinet just five months into office.

Oscar Vidarte, a political science at Lima's Catholic University, said the Cabinet shuffle pointed to another abrupt change in the political style of Humala, who lost the 2006 presidential election running as an acolyte of Venezuela's socialist president, Hugo Chavez.

This is worrisome. We've gone from a candidate who was a Chavista to a candidate who was a moderate leftist, to a pro-business president and now, suddenly, a pro-military guy, he said.

The government said all ministers in the cabinet tendered their resignations after Lerner stepped down. Under Peruvian law, if the prime minister quits the other cabinet members must do so as well, to give the president a free hand in deciding whether to fire them or keep them in their posts.

The president's office did not say who else in the cabinet might be replaced or when.

Besides Lerner, influential centrists include Finance Minister Luis Miguel Castilla, Mines and Energy Minister Carlos Herrera and Trade Minister Jose Luis Silva, who has pushed ahead with an ambitious free-trade agenda that Humala had once criticized.

Humala won the presidency in June on promises to steer more social spending to rural areas to help calm social conflicts over natural resources while assuring companies their investments would be safe in Peru's surging economy.

(Reporting by Marco Aquino, Patricia Velez and Terry Wade; Editing by Anthony Boadle and Todd Eastham)