The mayor of Rio, Eduardo Paes, carried the torch on its first few laps through the city center, the BBC wrote.

But there were chaotic scenes later in the north of the city when the torch relay was challenged by hundreds of demonstrators angry at the high cost of hosting the Games.

Riot police used tear gas and pepper spray to disperse the crowd.

Read alsoISIS planning 'dirty bomb' terror attack on Rio Olympics – mediaImages on news websites showed at least one policeman appearing to fire a projectile directly at a protester.

They showed crowds of people including many families with children who had come out to watch the torch relay running away in fear from the police action.

The police told local media that a group of people refused to leave one lane of the road open for the torch as had been agreed earlier and blocked the street in one place.

They said they had to intervene to contain the chaos and clear the road.

The BBC's Wyre Davies in Brazil says that this is exactly what Olympic organizers feared might happen after what has been a relatively peaceful and sometimes spectacular torch relay.

On Tuesday at least three protesters were arrested by the police in the town of Niteroi, across the bay from Rio during the torch relay there.

The police used pepper spray and part of the relay had to be abandoned.

Brazil is in the grip of a deep recession and political crisis, and further protests are expected ahead of the Olympic opening ceremony on Friday.

Organizers say more than a million tickets remain unsold.