All 13 people taken hostage on a bus in western Ukraine were freed unharmed after President Volodymyr Zelenskiy spoke by phone with the hostage-taker and agreed to his demand to endorse a 2005 animal rights documentary.
Police arrested the suspect, whom the state security service (SBU) identified as 44-year-old Maksym Kryvosh, who seized the bus in the city of Lutsk, saying he was armed with guns and explosives.
Interior Minister Arsen Avakov said Kryvosh had served time in prison and the SBU said he had propagated "extremist views". Police said Kryvosh threatened to blow up the bus and detonate another explosive in a crowded area in the city.
In a move to secure the hostages' release, Zelenskiy said he spoke to Kryvosh for seven to 10 minutes and agreed to one of his demands, to promote the documentary Earthlings, narrated by Hollywood actor Joaquin Phoenix.
Zelenskiy did so in a six-second clip posted on the presidential Facebook page, which was subsequently deleted.
The president said he had persuaded Kryvosh to first release three of the hostages, including a pregnant woman.
"We agreed that he would release three people and after that I will record a video," Zelenskiy said.
Zelenskiy had been given the option of launching an assault on the bus, but did not want to risk hostages dying during the attack.
"We have the result - everyone is alive," he said.
The SBU published a picture of Kryvosh sprawled on the ground with security personnel standing over him after his arrest. Avakov said an accomplice of Kryvosh was detained in the eastern city of Kharkiv.
Police had blocked off the city centre with armed officers, cars and an armoured personnel carrier while they tried to persuade Kryvosh to free the hostages in a day-long standoff.
Photos and footage showed a small bus parked in the middle of an empty street, with at least two windows smashed and others covered with curtains. Police said Kryvosh threw a grenade out of the bus. Avakov said Kryvosh had fired shots out of the bus at police.
In posts on social media, Kryvosh had also demanded that senior Ukrainian officials publish statements saying that they were terrorists.
"The film this man is talking about is good. And you don't have to ... create such a nightmare for people all over the country. The film can be watched without it," Avakov said.