LIMA, Sept 21 (Reuters) - Peru's energy and mines minister said on Tuesday the government wants to revise the framework for the country's mining industry, redrafting the umbrella law that regulates the sector, as well as the legislation that sets royalty payments.

Peru is the world's No. 2 copper producer. Leftist President Pedro Castillo wants to raise taxes on mining companies to fund social programs, but has offered few details since assuming office in July.

Shares of Peruvian miners have fallen on the perceived risk of those changes.

Energy and Mines Minister Ivan Merino, speaking at the Perumin conference organized by mining corporations, said he wants to redraft Peru's "General Mining Law," the legal framework that regulates the sector.

While he did not specify what changes he would like to see, he said all new mining projects should have a "neutral effect" on the people, often indigenous communities, who live near Peru's Andean mines.

He added he also wants to revise the law that regulates the use of mining royalties, which go to the regional governments that host Peru's mines.

Merino said he wanted to add flexibility to how those resources can be used.

Either change requires support from Peru's fragmented Congress, which analysts say is more likely to lead to gridlock than reform.

Merino added that Peru has a pipeline worth $50 billion in mining investments and confirmed https://www.reuters.com/article/peru-mining-rail/peru-wants-mining-companies-to-help-build-railway-to-pacific-coast-idUSL1N2PW1EU the government wants to develop a train to transport metals to the coast from the Andes.

He also reiterated that the government wants to see miners focusing on "social profitability," a concept several executives said they endorsed.

Rag Udd, Americas president for BHP Group Ltd, which is part owner of the Antamina mine in Peru, said Peru faces a "historic opportunity" to benefit from increased demand for copper as industries seek to lower carbon emissions.

"However, this opportunity cannot be taken as certain. It requires competitiveness and stable policies," Udd added. (Reporting by Marcelo Rochabrun; Additional reporting by Fabian Cambero in Santiago; Editing by Aurora Ellis and Peter Cooney)