Peru's leftist president has signed a law requiring mining and energy firms to consult rural communities over new projects, a step aimed at averting conflicts that have stalled investments in recent years.

Rights groups representing indigenous communities have long called for the so-called consultation law, which stops short of giving them veto power over projects and is welcomed by industry leaders in the resource-rich Andean country.

More than 100 people have been killed in recent years in conflicts over water, pollution or natural resources, often pitting residents in impoverished regions against foreign mining and oil companies.

Peru's ombudsman says the new law, approved unanimously by Congress last month, could quell disputes that often turn violent and pose a threat to some $50 billion in investments planned for the next decade.

President Ollanta Humala, who pledged to ensure the poor take part in an economic boom when he took office in July, signed the law Tuesday in a jungle town where 33 people died in a clash between police and indigenous protesters two years ago.

We've taken an important step to solving a problem, we're building a republic that respects all its nationalities, Humala said in the town of Bagua.

Violence erupted in Bagua during a protest calling on then-president Alan Garcia to repeal laws encouraging foreign mining and oil investment in the rainforest.

Garcia vetoed an earlier version of the consultation law last year, saying it gave towns the power to turn away investment needed for development.

The version of the law signed by Humala requires companies to try to reach agreement, but does not grant veto powers to local communities. That change has won support from business.

If we've got well-informed people in the communities, if we've got clear and transparent rules, this could be a very interesting law for this country, said Pedro Martinez, head of the national mining society. In many cases the conflicts have been caused by misinformation.

Some indigenous leaders have been losing faith in Humala, a former anti-capitalist radical who has recast himself as a moderate leftist.

But hundreds of indigenous supporters gathered in Bagua on Tuesday, cheering Humala as he donned traditional beaded necklaces for the signing ceremony.

We're in favor of this law, there has to be shared consent by communities and the government, Pedro Ciollo of the leading AIDESEP indigenous rights group told Reuters.