UPDATE 3-Indonesia to pay $3.85 billion for majority stake in Freeport's Grasberg copper mine

Grasberg copper mine@

* Indonesia to gain 51.38 pct stake in Freeport's local unit

* Freeport now closer to ending years of negotiating (Recasts, adds detail on transactions, quotes)

JAKARTA, July 12 (Reuters) - Indonesia on Thursday struck an agreement with Freeport-McMoRan Inc and Rio Tinto to buy a controlling stake in the world's second-biggest copper mine via a series of transactions valued at $3.85 billion.

The heads of agreement establishes a structure for Indonesia, through its state-owned mining holding company PT Inalum, to gain control of the Grasberg mine located in the country's eastern province of Papua. The deal should cap years of wrangling over the rights for the site as Jakarta seeks to gain greater control over its mineral wealth.

Last August, the two sides agreed to let Freeport keep operating the mine possibly until 2041 while ceding control over its local unit, PT Freeport Indonesia.

Aside from increasing government revenues, Jakarta hopes the agreement will serve as "a commitment to a conducive investment climate" in Indonesia, Finance Minister Sri Mulyani Indrawati said at a signing ceremony.

Under the agreement, Inalum plans to acquire the Indonesian unit of Rio Tinto, which holds a 40 percent participating interest in Grasberg, for $3.5 billion, said Inalum chief executive Budi Gunadi Sadikin.

That interest would then be transferred to Freeport Indonesia and converted into a 40 percent equity holding in the local unit via a rights issuance that would then be given to Inalum.

A subsequent purchase of the share of Grasberg held by Freeport-McMoRan unit PT Indocopper Investama, worth $350 million, would give Indonesia a total holding of 51.38 percent in Freeport Indonesia, Sadikin added.

The transactions will be completed later this month, said State-Owned Enterprises Minister Rini Soemarno.

Freeport Chief Executive Officer Richard Adkerson called the agreement a "positive step." He added, "We're committed, totally committed, to make this public-private partnership a success story."

ROYALTIES

Freeport estimates the deal will mean Indonesia takes more than 70 percent of the "benefits" of Grasberg through taxes, royalties and dividends to Inalum, Adkerson said, estimating a total figure of between $60 billion to $90 billion.

Earlier, Indonesian President Joko Widodo praised the agreement as "a leap forward."

"We have to have a larger amount of income from tax, royalties, dividends ... so, the value of our mining sector can benefit everybody," Widodo told reporters before the agreement was signed.

With presidential elections due in 2019, sealing a deal to get a majority stake for Indonesia in Grasberg is a priority for Widodo, who is widely expected to seek a second term in office.

The deal is also critical for the massive investment needed to develop underground mines at Grasberg as the current open-pit operation is phased out later this year.

Still, planned agreements on how Freeport will manage mine operations with Inalum as the majority shareholder also need to be resolved.

"All parties have committed to work towards agreeing and signing binding agreements before the end of the second half of 2018," Rio Tinto said in a statement.

Rio warned that "there is no certainty that a transaction will be completed."

During Freeport's five decades of operating Grasberg, there has been frequent friction between the government and the company over revenue sharing and the mine's social and environmental impact.

Efforts to finalize a deal have been complicated by concerns over the environmental impact of the project, in particular its handling of mine waste or tailings.

Environment Minister Siti Nurbaya must still issue a recommendation to Freeport Indonesia before the miner can secure the rights to Grasberg up to 2041.

"We hope the environmental management continues to improve," Nurbaya said at the signing ceremony, "(and) we believe Freeport can protect the sustainability of affected areas." (Additional reporting Gayatri Suroyo and Maikel Jefriando in JAKARTA and Susan Taylor in TORONTO; Writing by Fergus Jensen and Ed Davies; Editing by Richard Pullin and Christian Schmollinger)