Brazil’s federal government has reached a multibillion-dollar settlement with the mining companies responsible for a 2015 dam collapse that has been called the country’s worst environmental disaster.

Under the agreement, Samarco — a joint venture of Brazilian mining giant Vale and Anglo-Australian firm BHP — will pay 132 billion reais (£17.7 billion) over 20 years to compensate for human, environmental and infrastructure damage caused by the release of an immense amount of toxic mining waste into a major river in south-eastern Minas Gerais state, killing 19 people and ravaging entire villages.

“We are fixing a disaster that could have been avoided but wasn’t,” President Luiz Inacio Lula da Silva said in a hall of the presidential palace, surrounded by governors of the affected states, members of his administration, reporters and victims.

His speech, filled with criticism of what he called the mining companies’ irresponsibility in chasing profit over safety, was met with applause from the audience.

Brazil Mining Disaster Agreement
Brazil’s President Luiz Inacio Lula da Silva speaks at the signing ceremony (Eraldo Peres/AP)

The toxic sludge — enough to fill 13,000 Olympic-size swimming pools — flowed down the Doce River for 420 miles to the Atlantic Ocean, contaminating waterways and coastal areas in two neighbouring states.

The mining companies told the federal government during negotiations that they had already paid 38 billion reais (£29 billion) in reparations.

The settlement includes compensation for more than 300,000 victims, though that figure does not account for everyone affected. Twice as many people — 620,000 — took their case to a UK court on Monday seeking reparations.

The class action lawsuit at the High Court in London seeks an estimated £36 billion in damages from BHP. The case was filed in Britain because one of BHP’s two main legal entities was based in London at the time.

The London suit prompted the Brazilian Supreme Court’s Chief Justice Luis Roberto Barroso to personally seek Lula’s commitment to ensure parties reached an agreement domestically.

“I spoke with Lula and said, ‘Mr President, there is a case abroad, and it will be very damaging to the Brazilian courts if this matter is resolved outside the country,’” Mr Barroso said on Friday at the presidential palace.

The Brazilian federal government said victims would receive 35,000 reais (£4,740) each while fishermen and farmers would be paid 95,000 reais (£13,100) in total through monthly instalments over four years.

Cristiano Sales, 42, was born and raised in Bento Rodrigues, one of the districts in the municipality of Mariana that was washed over by the sludge nine years ago. When he returned to the ruins of his house three months later, the only item he found was a shirt from his favourite soccer team, Cruzeiro.

Brazil Mining Disaster Agreement
Cristiano Sales stands in front of the ruins of his house (Eleonore Hughes/AP)

Mr Sales lives in a new house in a neighbourhood built by the mining companies as part of compensation to his father. After filing a lawsuit, he personally received 100,000 reais (£13,900) and is still pursuing additional reparations through the London suit.

“Money can’t pay for what we’ve been through here,” he said. “We take the money because it’s our right. But to say that 100,000 or even 200,000 or 300,000 could bring back the life we had — I don’t think any amount of money can do that.”

Australia-based BHP said in a statement earlier this week it believes the UK action is unnecessary because it duplicates matters covered by reparation efforts and legal proceedings in Brazil but will continue to defend itself.

Pogust Goodhead, the law firm representing the plaintiffs, said on Friday the settlement in Brazil should not have any impact on the London case and that there will be no double compensation.

The firm added that its clients were excluded from the negotiations and are still pursuing full reparations for unresolved damages.

“The Mariana agreement signed this Friday in Brazil demonstrates that, after nine years of negligence, the mining companies have finally decided to react to the pressure from public opinion and the trial in England, which began last Monday,” the law firm said in a statement.

“Even so, the amounts defined are far from covering the profound losses suffered by the victims, who continue to fight for justice and full reparations.”