Following a day of extraordinary drama, Ukraine faces a new and uncertain future after the country's parliament voted to impeach the president, and Yulia Tymoshenko, the former prime minister, was released from prison. She has pledged to stand in elections in May.

As the president, Viktor Yanukovych, fled the capital, and parliament voted to strip him of his powers, he likened the actions of his opponents to those of the Nazis and said he would battle to stay in power. However, those willing to stand by Yanukovych diminished by the hour as his aides fled Ukraine and the president himself was accused by border officials of a failed attempt to fly out of the country. The army said it would not get involved, and police in key eastern areas said they were "with the people".

In eastern Ukraine and Crimea there was fury at events in Kiev, and all eyes will now be on Russia, where the foreign minister, Sergei Lavrov, labelled the opposition "rampaging hooligans" and called on Europe to rein them in.

There are fears that, with Yanukovych losing control of the west of the country and Kiev, Russia may attempt to promote separatist movements in Crimea, which is largely ethnically Russian.

William Hague, the foreign secretary, said that the UK and its European Union allies would support a new government "as and when it is formed" and urged politicians in Ukraine to work together.

In a dramatic twist, Tymoshenko was set free on Saturday evening, heading straight to Kiev where she hailed gathered protesters as "heroes" and urged them to continue their fight until change had been secured.

"This is your victory because no politician, no diplomat could do what you have done, you have removed this cancer from this country," she told them. Tymoshenko said she regretted not being with them as they manned the barricades and people were killed. "Every bullet that killed those people was a bullet in the heart of all of us," she said. "You have to remember their faces, you have to have their faces before your eyes and remember their sacrifices," she said.

"Now you have a right to rule this country and decide for this country. Ukraine has an opportunity to build its own future today." Tymoshenko was jailed in 2011 for "abuse of office", in a trial many said was Yanukovych's revenge against his arch-rival. She spent much of her sentence under armed guard in a hospital in the eastern city of Kharkiv being treated for back problems.

Yulia Tymoshenko speaks to a crowd on Kiev's Independence Square. Photograph: Genya Savilov/AFP/Getty Images

After Yanukovych fled Kiev late on Friday night, his representatives in parliament said that the president planned to resign, but Yanukovych later appeared in a short television interview, apparently recorded in eastern Ukraine. "They are trying to scare me. I have no intention of leaving the country. I am not going to resign, I'm the legitimately elected president," he said, looking shaken. "Everything happening today is, to a large extent, vandalism and banditry and a coup d'état. I will do everything to protect my country from breakup, to stop bloodshed."

On Friday, three EU foreign ministers met Yanukovych and opposition leaders, and agreed to presidential elections by the end of 2014. Within hours parliament began passing a series of resolutions, stripping Yanukovych of his powers, initiating impeachment proceedings and setting elections for 25 May.

In Kiev, the lines of riot police that have stood at key points across the capital disappeared on Saturday morning, leaving the city in the hands of the protesters.

Yanukovych described the events as a "repeat of the 1930s when Nazis came to power in Germany and Austria".

He said the parliamentary session was illegal, and in Moscow, Lavrov called his counterparts in Berlin, Warsaw and Paris to ask them to "rein in the opposition". He claimed that the protests, centred on Independence Square, known as the Maidan, were led by fringe extremists, and called on European nations to force the opposition to stick to the deal signed in Kiev on Friday.

"The opposition has not only failed to fulfil any of its obligations, but is presenting new demands all the time, following the lead of armed extremists and pogromists who pose a direct threat to Ukraine's sovereignty and constitutional order," he said. "It's time to stop misleading international public opinion, and pretending the Maidan represents the interests of the Ukrainian nation."

Even in the east of the country, Yanukovych's authority was eroding rapidly. In Dnepropetrovsk, one of the region's biggest cities, the police force released a statement saying it was "with the people", while in the eastern city of Kharkiv the mayor and governor were reported to have fled to Russia.

In Crimea, however, the local parliament's speaker has said the region may secede from Ukraine if events continue.

On the streets of Kiev and at the Maidan, after a tumultuous day in which the three-month protest appeared to have won a decisive victory, there was celebration, but also a sense that with the job finally done in removing Yanukovych, the real work now begins. "So many things have happened these days, some pleasant, some not, it is hard to know how I feel," said Denis Romanov, 30, an engineer. "Ukraine won't ever be the same again, and I mean this in a good way. Ukraine has been reborn in these events."

Mykhailo Gavryliuk, a Cossack who in January was stripped naked and humiliated by riot police, sat on a pile of sandbags with rain trickling down his face. He offered a sober view of the future, saying that this was not yet a decisive victory. "For that we need a leader who loves Ukraine more than himself," he said.

Additional reporting by Harriet Salem and Lin Jenkins