For this week, at least, Andriy Sadovyy is one of the world's most powerful mayors. The head of this elegant city in the far west of Ukraine, he commands his own security force, and sees himself as having no one to report to in the national government.

Long a bastion of Ukrainian nationalism, Lviv this week declared itself autonomous from the government in Kiev after security forces in the capital used deadly force against anti-government demonstrators, many of whom hail from this part of Ukraine.

As the violence in Kiev escalated, rioters here smashed their way into the city's police stations and the prosecutor's office, as well as part of an army base in the city. As security forces evaporated, unknown protesters lit the buildings ablaze in a show of anger against anything associated with the regime of Viktor Yanukovych.

Story continues below advertisement

In the wake of that violence, a new order has come to this city of 725,000 people, in the form of citizen "self-defence units" that have set up outside key government offices. The volunteers say they take their orders from the mayor's office.

"The only boss I report to is the local community, " Mr. Sadovyy said in an interview inside the town hall building, at the cobblestoned centre of this city that has the most European look and feel of any in Ukraine.

"We are a free city, we have a free people. We have respect for the constitution of Ukraine. We live in freedom and we want the rest of Ukraine to be free."

Mr. Sadovyy says Lviv's autonomy is temporary, especially now that pro-Western forces have taken control of parliament in Kiev. But Lviv will retain its de facto independence until he sees stability – in the form of a new President and reformed security services – in the rest of the country.

In the meantime, Ms. Sadovyy says he's simply pushing ahead and building the kind of society the protesters in Kiev have been fighting and dying for.

In Lviv, just 70 kilometres from the border of Poland, the idea that Ukraine's future lies in closer ties with Russia makes little sense. While cities like Donetsk and Kharkiv in the east of Ukraine are dominated by the same blocky Soviet architecture as Russian cities, the Renaissance-inflected buildings here remind you Lviv was once part of the Austro-Hungarian empire, and then Poland after that.

While much of Ukraine was under Russian rule for two centuries before the 1991 collapse of the Soviet Union, Lviv only came under Moscow's control via the Molotov-Ribbentrop pact of 1939. Long afterward, the region was a hotbed of anti-Soviet resistance, home to the paramilitary Ukrainian Insurgent Army that battled (briefly with Nazi help) to create a separate Ukrainian state.

Story continues below advertisement

Ukrainian nationalism was crushed by the Soviet KGB, which made the headquarters of its successor agency, the Security Service of Ukraine, a natural target for the crowds this week. By Saturday, the intelligence agency's headquarters – long the most feared address in Lviv – was being guarded by a group of ordinary citizens.

"I'm not protecting the building, I'm protecting the peace," said Serhiy Butivchenko, a 47-year-old owner of a construction company and head of the 15-man self-defence forces unit that also included engineers, architects and entrepreneurs. "There are 15 of us here right now, but if we need it, we can bring hundreds," he explained. "All of Lviv is part of the self-defense forces now."

Despite the lack of police or prosecutors in the city, Mr. Sadovyy said the Lviv's crime rate has fallen by "300 per cent" since police disappeared and were replaced by the self-defense units. Despite some occasionally wild traffic – intersections are to be approached with caution in the absence of anyone tracking who tears through a red light – the city does indeed have a safe and orderly feel that is rare in the Ukraine of the moment.

Most "self-defense forces" are made up of unarmed volunteers, but Mr. Sadovyy said many are actually police who have thrown their support to the opposition. But they're afraid to put their uniforms back on in case that makes them a target for attack.

Lviv's security volunteers have also travelled in groups to bolster the protesters in Kiev, and this weekend has been filled with funerals for Lviv residents killed during a week of violence in the capital.

While Mr. Sadovyy unquestionably has the support of his city – his office is barely guarded despite the tension in the rest of the country – he was clearly flirting with separatism when he declared autonomy at a time when it looked Mr. Yanukovych might succeed in crushing the demonstrators in Kiev.

Story continues below advertisement

Now, however, he rejects questions about the possible breakup of Ukraine. He's harshly critical of local governors in the east and south of the country who have made similar declarations of autonomy following Mr. Yanukovych's ouster from the capital and the rise of a pro-Western government there.

"We are a single country and we will not give away a single metre of our land," Mr. Sadovyy says. "No anti-Ukrainian plot to split the country will succeed."

Follow me at @markmackinnon