Brazilian security forces have shot dead a man who hijacked a bus on a bridge across Guanabara Bay in Rio de Janeiro and took nearly 40 people hostage.

The hijacking began at about 5am on Tuesday when a masked man commandeered a commuter bus on the bridge, which connects Rio with the city of Niterói. The man took 37 people in the bus hostage before freeing six of them, officials said.

About four hours later, the man walked out of the bus, flung a backpack toward police and then was seen falling to the ground as he tried to reenter the vehicle, TV images showed. Police officials said he was shot by a police sniper. They did not provide any other information on him. All hostages emerged from the bus unharmed.

“Congratulations to the Rio de Janeiro police for the successful action that ended the bus hijacking on the Rio-Niterói Bridge this morning,” the president, Jair Bolsonaro, wrote on Twitter on Tuesday. “The criminal was neutralised and no hostage was injured. Today, no family member of an innocent person will be in tears.”

Bolsonaro, a far-right former federal congressman who represented the state of Rio de Janeiro for nearly three decades, has long called for police to take a tougher line in the face of years of rising crime. In 2015, he said Brazil’s military police should “kill more people”. Since taking office in January, he has sought to broaden access to guns and has pushed for measures to protect police if they kill on the job.

Although the number of murders in Rio has fallen sharply in recent months, the city’s police have killed 15% more people so far this year compared with the same period in 2018. A total of 881 people, or nearly five per day, died at the hands of police between January and June, putting 2019 on track for the highest number since records began in 2003.

In Rio, many use specialised apps to safely navigate their way past the daily gun battles between police, drug gangs and vigilante militias comprised of current and former police officers.

Local media reported the unidentified hijacker was armed with a plastic gun but there was no official confirmation. Hans Moreno, a passenger on the bus, told GloboNews the man had a pistol and a knife, and never explained to passengers the reasons for his actions.

As the hijacking ended, Rio’s governor, Wilson Witzel, arrived by helicopter and bounded across the bridge to hug police involved in the operation. Witzel, a close ally of Bolsonaro who also took office in January, says police should kill anyone carrying a rifle, and has ordered snipers to fire on suspects from helicopters.

Facebook Twitter Pinterest Wilson Witzel on the Rio-Niterói Bridge after the hijacker was killed on Tuesday. Photograph: Reuters

In an interview with journalists at the scene, Witzel celebrated the outcome but lamented the death of the hijacker.

“We don’t want anyone to die but ... the police will act rigorously and will not be lenient with those who endanger other people’s lives,” he said, while also defending his previous arguments in favour of police shooting armed suspects.

“Some people do not always understand that police work sometimes has to be this way,” he said. “If they had not shot this criminal, many lives would not have been spared.”