Brazil's supreme court has upheld major changes to laws protecting the Amazon rainforest, delivering a blow to environmentalists.

The revision of the 2012 law includes an amnesty programme that scraps penalties for landowners who have cut trees down illegally in the past.

Environmentalists say it will make illegal deforestation of the world's largest rainforest acceptable.

Farmers say the changes give producers confidence to grow the economy.

The Amazon rainforest is the largest tropical rainforest in the world and home to plant and animal species that are still being discovered by scientists.

Most of its millions of square kilometres are inside Brazil, where under laws dating back to 1965, landowners must keep a percentage of their terrain forested.

That percentage ranges from 20% in some parts of the country to 80% in the Amazon.

But the supreme court's decision eases that rule. Attorney General Grace Mendonca has defended the change saying it struck a balance between environmental protection and economic development.

The revised rule will reduce the amount of land that should be restored by 112,000 sq miles (290,000 sq km) - an area the size of Italy.

It also provides an amnesty from fines owed for illegally clearing trees before July 2008, although larger landholders would have to replant most of the cleared area or preserve the same amount of land elsewhere.

Environmentalists say the revised laws will reward those who have deforested in the past.

Speaking to Reuters, Nurit Bensusan from the non-governmental organisation Instituto Socioambiental said: "With this amnesty you create a climate that invites deforestation in the future. It creates the impression that if you deforest today, tomorrow, you are handed an amnesty."

Under the new bill, farmers will be able to cultivate land closer to hilltops and riverbanks, which are especially vulnerable to erosion if trees are chopped down.

Farmers and Brazil's powerful agriculture lobby argue that the new laws allowed for continued growth of a key sector of the Brazilian economy without hindering it by dealing with crimes from the past.