The Olympic torch has arrived in Rio de Janeiro by boat after a three-month tour of Brazilian cities.
The mayor of Rio, Eduardo Paes, carried the torch on its first few laps through the city centre.
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.
Images shown 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 organisers 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.
Organisers say more than a million tickets remain unsold.