Ukrainian authorities on Tuesday detained a man who had taken more than a dozen hostages on a bus, ending a 12-hour standoff with police, officials said.

All 13 hostages on the bus were freed unharmed. The suspect had initially released three of the hostages, including a pregnant woman, after negotiations with the first deputy chief of national police, Yevhen Koval.

A policeman brings water for hostages contained in a bus after an armed man seized the long-distance bus and took 13 people hostage in Lutsk.

A policeman brings water for hostages contained in a bus after an armed man seized the long-distance bus and took 13 people hostage in Lutsk. (Ukrainian Police Press Office via AP)

During the standoff, Koval had delivered water to the hostages. At one point, the assailant fired his gun and a bullet narrowly missed Koval.

Ukraine's President Volodymyr Zelenskiy posted a brief video message on his Facebook page urging Ukrainians to watch a film – as the hostage-taker had wanted.

Minutes later, the assailant surrendered to police and authorities said all 13 hostages were freed.

Speaking to reporters after the ordeal, Ukraine's Interior Minister Arsen Avakov described the assailant as an "unstable man who invented his own world."

UKRAINIAN PRESIDENT’S WIFE HOSPITALIZED AFTER TESTING POSITIVE FOR CORONAVIRUS

Police sealed off the center of Lutsk – about 250 miles west of Kyiv – after the assailant, who police said was armed and carrying explosives, took over the bus. The assailant threw explosives out of a bus window, but no one was hurt. He also fired several shots at a police drone.

The man called the police himself at 9:25 a.m. local time after taking control of the vehicle and introduced himself as Maksim Plokhoy, Deputy Interior Minister Anton Gerashchenko said on Facebook.

According to Gerashchenko, police have identified the man as Maksim Krivosh, a 44-year-old Ukrainian born in Russia. Krivosh had reportedly been convicted twice on a wide range of charges – robbery, fraud, illegal arms handling – and spent a total of 10 years behind bars.

CLICK HERE TO GET THE FOX NEWS APP

Local media reports that Krivosh tried to reach out to journalists through hostages and their phones, demanding that they spread the word about his demands and get more reporters to arrive at the scene.

The Associated Press contributed to this report.