Image caption State politicians were among those protesting in Rio de Janeiro this week

Brazilian President Dilma Rousseff has vetoed part of a law intended to share royalties from Brazil's oil fields across the country's 26 states.

Rio de Janeiro governor Sergio Cabral had warned the measure could bankrupt his state ahead of the 2016 Olympics.

President Rousseff vetoed that part of the legislation which would have affected existing oil concessions.

But she retained a measure spreading wealth from yet-to-be-explored oil fields which are still to be auctioned.

The development comes after some 200,000 people protested in Rio de Janeiro against the bill, which they said would deprive Rio state of much of its oil revenue.

Local politicians had said it could cost the state $1.7bn (£1.06bn) next year.

They also said that the changes would affect Rio's ability to host the 2014 football World Cup and the 2016 Olympics.

Some of the largest oil finds in recent years have been discovered off the Brazilian coast.

Brazil's main oil-producing states had threatened legal action over the measure.

A new structure for distributing royalties has to be in place by January in order for auctions of "explorations blocks" to go ahead.

Brazil's Education Minister Aloizio Mercadante says 100% of the profits from new oil concessions should be used to improve education in Brazil.