Peruvian President Ollanta Humala on Saturday replaced his prime minister with his interior minister -- a former army officer like himself who played a key role in quelling a recent spate of social unrest.

Local media had predicted for several weeks that a cabinet reshuffle was likely, as Humala -- the country's first leftist president in almost four decades, who took office in July -- looks to consolidate his power.

Humala's new prime minister, 62-year-old Oscar Valdes, had taken on a more robust role in the past few weeks as the government worked to defuse labor tensions, especially in a restive northern mining area.

Valdes replaces Salomon Lerner, a millionaire businessman and onetime close aide to the president who had played a key role in Humala's election campaign earlier this year.

"With the sole purpose of giving you complete freedom to make any necessary adjustments in the cabinet, I offer you my irrevocable resignation," Lerner said in a letter to Humala, a copy of which was seen by AFP.

A statement from Humala's office said the president had accepted Lerner's resignation, "thanking him for his important service to the nation," and named Valdes to succeed him.

The statement did not say whether Valdes would also continue on as interior minister.

Lerner's resignation automatically triggered the resignation of the entire cabinet, according to Peruvian law. The ministers traditionally step down each December to allow the president some leeway to reshuffle his cabinet.

Many of Peru's current ministers could keep their jobs under Valdes, La Republica newspaper -- seen as close to the government -- reported on its website. The new government was to take the oath of office over the weekend.

The departure of Lerner, a millionaire businessman before entering government, comes after Humala declared a state of emergency in Cajamarca department in the north in a bid to quell several days of labor unrest.

Workers in Cajamarca had gone on strike for more than 10 days in protest at what they fear will be adverse environmental impact from a planned $4.8 billion gold and copper mining initiative.

Valdes was instrumental in the declaration of that state of emergency.

He also has given the impression of being a hands-on minister, traveling by helicopter to another scene of unrest in the south, where one person had been killed and three injured in clashes between protesters and police.

Humala, who succeeded center-right leader Alan Garcia, has pledged to confront the high poverty plaguing his Andean nation despite its solid economic growth.

Humala won a second-round run-off in June over Keiko Fujimori, daughter of Peru's disgraced former president Alberto Fujimori.

He brought together liberals and moderate leftists for his eclectic first cabinet, including leftist writer Rafael Roncagliolo as foreign minister and Lerner as his prime minister.

But those disparate voices sometimes spoke up against Humala.

One deputy environment minister resigned last month, denouncing the government's lack of a clear "strategy" on environmental and social conflict, especially with respect to the powerful mining sector.

The changing of prime ministers is relatively common in Peru -- Garcia had five in five years.