Bill makes it easier for Amazon farmers to comply with rules that stipulate how much forest they must preserve, campaigners say.

Brazil's congress voted late on Wednesday to ease rules mandating the amount of forest farmers must keep on their land, delivering a long-sought victory to the country's powerful agriculture lobby and a political defeat for president Dilma Rousseff.

Though the bill will require millions of hectares of already cleared land to be replanted, environmentalists say it makes it too easy for farmers, responsible for much of the deforestation of the Amazon and other swaths of environmentally sensitive land in recent decades, to comply with regulations that stipulate how much forest they must preserve.

Rousseff still has the option to veto the bill, one of the most controversial to pass Brazil's congress in recent years. The bill was supported by some of her party's senators and members of its multi-party coalition, even though the president had previously said she would veto earlier versions of the law that contained provisions perceived as too lenient on farmers who have cleared woodlands for agriculture.

The final law, which was changed dramatically from a hard-bargained version her government was backing, will leave it to federal states to decide how much forest needs to be replaced alongside rivers, making it possible for big farming states to make only minimal demands of farmers.

"The approved bill gives a total and unrestricted amnesty to those who deforested ... and goes against what the government itself had wanted," environmental group Greenpeace said in a statement. "If [Rousseff] doesn't react and veto this text, this future will be her legacy," it said.

Pushing through the more lenient language the farming lobby sought was only possible through a rebellion by senators from within the government coalition.

A big enough majority in Congress could also knock down a veto by Rousseff, should she choose to use it.

"We lost. The government lost," said the leader of Rousseff's Workers party in the lower house of congress. The powerful farming lobby in congress had fought hard to minimise obligations the new law would impose on them.

The bill and its likely future impact have been watched closely in and outside Brazil, home to the world's biggest rainforest and a country considered a reference for how other developing nations manage their woodlands.

In June, Brazil will host the Rio+20 summit, a meeting at which government leaders and policymakers from around the world will discuss global environmental policy.

Head of the national agriculture confederation, Katia Abreu, defended the new law, saying it did "not necessarily" mean states would impose softer rules than the central government would have on mandatory riverside forest coverage. She said it would also allow better made-to-measure rules to be set according to each region's characteristics.

But Abreu hinted the new rules would be less rigid, saying farmers would have been obliged under the previous bill to replant 30 million hectares (74m acres) of forest and sacrifice land on which they grew billions of dollars worth of crops. She said it would only be possible to know how much would now have to be replaced after states had set rules.

A technician consulted on the policy said one drawback of allowing individual states to regulate it was that the process would probably take a year or two. That means replanting would likely be delayed until clear rules were made.

A key provision of the forest code, as it is known, would allow landowners to count woodland on river margins, hilltops and steep inclines towards a total proportion of forest that must be preserved on their land. At present, such land isn't allowed in their calculation. Farmers argue that uncertainty over existing legislation, which has effectively been suspended in recent years, impeded investments. And Brazil's growing output of food crops – and an enviable position as an agricultural powerhouse – could face setbacks if farmers continue to be held back by doubts about how they can use their land.

Brazil is the world's top producer of coffee, sugar, beef and orange juice and a major producer of soy and corn. Agriculture accounts for more than 5% of Brazil's GDP.

Environmentalists say farmers would have to reforest land equivalent to the combined area of Germany, Austria and Italy to fully comply with existing regulations. Advocates of the new bill, however, say it would still result in a net gain of millions of hectares of forest coverage.

Under the terms of the new bill, farmers must sign up for a reforestation programme that will use satellites to track compliance. Those falling foul of the new law could be denied rural finance.

One government official estimated last year that 24m hectares (59 million acres), roughly an area the size of the United Kingdom, would be reforested as a result of the new code. But experts say the area to be replanted will be difficult to gauge until more data is collected about rural properties.