Ukrainian police on Saturday freed the remaining hostages being held in a post office by a man believed to be strapped with explosives. They arrested the hostage-taker after an hourslong standoff in the city of Kharkiv.

"All hostages freed in Kharkiv. The assailant was arrested," President Petro Poroshenko wrote on Twitter, while Interior Minister Arsen Avakov published a picture of the man, with blood streaming down his face, being held by a policeman.

None of the hostages were harmed. A Reuters witness saw special forces police in green camouflage rushing to the entrance of the post office, a yellow-and-white building at a road junction in the northeastern city near the Russian border.

Robbery turned hostage taking

In earlier statements, police said the man had entered the post office wearing a mask and taken 11 people hostage with the intention of robbing the place. Five of the hostages, three women and two children, were released early.

Regional police chief Oleg Bekh told reporters the man had a history of antisocial behavior and drug-related offences.

"He probably needs the help of a psychiatrist," Bekh said. "During the detention, he received minor injuries. He was not in a normal state ... the hostages said he was drinking alcohol."

Police were able to enter the building after one of the hostages opened the door for them, Kharkiv regional prosecutor Yuriy Danylchenko told reporters.

Police earlier said they had been in contact with the man via the telephones of the hostages, describing his manner as calm and not making any demands.

Anton Gerashchenko, an adviser to Avakov, said employees at the post office and customers had been among the hostages. One of them had managed to call the police from inside the building.

"The patrolmen came to the place of the robbery in a few minutes," Gerashchenko wrote on Facebook. "The robber realized that he could not now safely leave the crime scene with the loot and he decided to declare that he was taking everyone hostage."

Bomb threat

One of the children released by the man told local media that he put explosives into two bottles and threatened to blow himself up if police did not listen to him.

The man also said he had brain cancer, according to the child.

The man at one point voiced concern about the recent prisoner exchange between the Ukrainian authorities and pro-Russian separatists and thought more prisoners should have been released, police said.

Ukraine and the separatists swapped hundreds of prisoners Wednesday in the biggest such exchange since the outbreak of a conflict in the eastern Donbass region that has killed more than 10,000 people.