Military police say they have "neutralised" a man who held dozens of passengers hostage for more than three hours on a commuter bus in the Brazilian city of Rio de Janeiro.
In a tweet, police said all hostages had been freed after a sniper shot the man dead.
Police had surrounded the bus which came to a standstill on a bridge linking Rio with Niterói.
None of the hostages were injured, police said.
A spokesman for the military police, Col Mauro Fliess, told a local TV programme that the sniper opened fire when the hijacker appeared at the door of the bus pointing what looked like a weapon at the head of one of the hostages.
Col Fliess told TV programme Bom Dia Rio said the weapon the man was carrying turned out to be a toy gun.
Col Fliess praised the force. "This is the police force we want to see. The sniper shot was necessary to neutralise the outlaw and to save the people on the bus," the colonel said.
At least six passengers had been freed before the sharp shooter took aim. Footage showed one of the released hostages fainting as she got off the bus.
At one point the hostage-taker could be seen leaning out of the open door with something resembling a petrol bomb in his hand.
Brazilian media said it was not clear if he had made any demands. He reportedly boarded the bus at 05:30 (0830 GMT) and threatened passengers.
He reportedly told the passengers he was a military police officer. Col Fliess said it had not yet been confirmed if he was an officer or just claimed to be.
The bridge on which the hijacking spans Guanabara Bay
One news site released a WhatsApp message reportedly written by one of the passengers, saying that the gunman had tied the passengers' hands and had a petrol can as well as a gun.
Traffic on the bridge has been blocked completely.
Military police had earlier tweeted (in Portuguese) that the special operations team was negotiating with the hostage taker: "Our officers are trained and have great practical experience in these types of situations."
They had also asked people to remain calm.
It is not the first time a bus has been hijacked in Rio. In 2006, a gunman held passengers hostage for 10 hours before surrendering.
In that case, one of those on board was the gunman's wife, whom he threatened to kill for leaving him. The man eventually surrendered after relatives were brought in to calm him down.