Peru said on Friday that it will crack down on violent anti-mining protesters after clashes with police injured 40 people, the first skirmishes since President Ollanta Humala took office vowing to defuse conflicts over natural resources.

Prime Minister Salomon Lerner said communities opposed to mining must peacefully negotiate with the government and companies to air their views, but cannot resort to blocking roads and vandalizing property.

Police fought with anti-mining protesters in the regions of Ancash and Apurimac on Thursday, a possible setback for Humala. A leftist former army officer, he is trying to mediate more than 200 environmental conflicts nationwide that often pit rural towns against mining and oil companies with $50 billion in projects planned in Peru for the next decade.

Humala has said he wants to see big mining projects, which would generate hundreds of millions of dollars in tax revenue for the government, go forward.

The rule of law must be respected using all necessary force, Lerner said on local radio. We will not allow these small groups to cause chaos in the country.

In the southern region of Apurimac, subsistence farmers opposed to small-scale wildcat miners shut down the city of Andahuaylas on Friday, a day after a fearful Agriculture Minister Miguel Caillaux was run out of town by rock-throwing protesters because he refused to issue a blanket ban on mining in the area.

Global miner Xstrata , whose $4.2 billion Las Bambas copper project in Apurimac is several hours away from Andahuaylas, was not targeted by protesters.

In the northern region of Ancash, protesters tried to occupy roads a day after police fired tear gas to clear blockades on major highways.

Private property and free transit must be respected. We will guarantee all necessary measures so that social peace prevails in this country, Lerner said.

Ancash protesters on Thursday temporarily invaded a pumping station of a mining duct outside Antamina, one of the world's top copper-zinc mines, owned by global firms BHP Billiton Ltd , Xstrata , Teck Cominco Ltd and Mitsubishi Corp , a company official said. Protesters say the mine causes pollution.

Humala, a former radical who has largely governed as a centrist since taking office in July, has tried to manage the expectations of rural voters who helped elect him while ensuring a stable environment for investors in Peru's fast-growing economy.

But he has also pushed companies to do more to win the support of rural towns near mines. He is also rushing to roll out social welfare programs in rural provinces, where many of the one-third of Peruvians mired in poverty live.

Asked if some of the protesters had voted for Humala, Lerner said: whether these people voted for us or voted for another candidate, order has to be guaranteed for all Peruvians.