The siege of a bus with about 20 passengers by an armed man on Tuesday has ended with all the hostages freed, Ukrainian police said. “The hostages are freed! The man who took hostages and kept them on a bus in Lutsk has been detained,” the interior ministry posted on Telegram

The hostage-taker has been identified Maksym Kryvosh. 44-year-old Kryvosh previously spent around 10 years in prison on charges including fraud and illegal handling of weapons, deputy interior minister Gerashchenko said. He was believed to have undergone psychiatric treatment, according to police. The interior ministry has denied this information.

Earlier, Ukrainian police were negotiating with the man who claimed to have planted a remote-controlled device in the western city of Lutsk. Police cordoned off the centre of the city of over 200,000, some 400 kilometres (250 miles) from the capital Kiev, and asked residents not to leave their homes or places of work.

The hostage-taker also fired shots at a police drone that flew over the bus and threw an explosive package into the street. An account which was later deleted by Twitter, posts under the attacker’s name claimed he was armed, including with bombs, and said that he wants top Ukrainian personalities to convey anti-establishment messages on social media.

The tweets described him as “anti-system”. The interior ministry told AFP it believed the accounts were genuine. Earlier the attacker “threw a grenade from the bus, which, fortunately, did not detonate,” a police statement said. Video footage and pictures published by local media showed armed police around a blue and white bus with several windows shattered and its curtains drawn.