(Reuters) - Just after midnight Monday, the Greek parliament approved a deeply unpopular austerity bill to secure a second EU/IMF bailout and avoid national bankruptcy, as buildings burned across central Athens and violence spread around the country.

Cinemas, cafes, shops and banks were set ablaze in central Athens as black-masked protesters fought riot police outside parliament.

State television reported the violence spread to the tourist islands of Corfu and Crete, the northern city of Thessaloniki and towns in central Greece. Shops were looted in the capital where police said 34 buildings were ablaze.

Prime Minister Lucas Papademos denounced the worst breakdown of order since 2008 when violence gripped Greece for weeks after police shot a 15-year-old schoolboy.

Vandalism, violence and destruction have no place in a democratic country and won't be tolerated, he told parliament as it prepared to vote on the new 130 billion euro bailout to save Greece from a chaotic bankruptcy.

Papademos told lawmakers shortly before they voted that they would be gravely mistaken if they rejected the package that demands deep pay, pension and job cuts, as this would threaten Greece's place in the European mainstream.

It would be a huge historical injustice if the country from which European culture sprang ... reached bankruptcy and was led, due to one more mistake, to national isolation and national despair, he said.

The chaos outside parliament showed how tough it will be to implement the measures. A Reuters photographer saw buildings in Athens engulfed in flames and huge plumes of smoke rose in the night sky.

We are facing destruction. Our country, our home, has become ripe for burning, the centre of Athens is in flames. We cannot allow populism to burn our country down, conservative lawmaker Costis Hatzidakis told parliament.

The air in Syntagma Square outside parliament was thick with tear gas as riot police fought running battles with youths who smashed marble balustrades and hurled stones and petrol bombs.

Terrified Greeks and tourists fled the rock-strewn streets and the clouds of stinging gas, cramming into hotel lobbies for shelter as lines of riot police struggled to contain the mayhem.

State NET television reported that trouble had also broken out in Heraklion, capital of the tourist island of Crete, as well as the towns of Volos and Agrinio in central Greece.

Despite the chaos, Finance Minister Evangelos Venizelos warned that Greeks faced unimaginably harsher sacrifices if parliament rejected the package, which demands deep pay, pension and job cuts, when it votes later in the evening.

On the streets many businesses were ablaze, including the neo-classical home to the Attikon cinema dating from 1870 and a building housing the Asty, an underground cinema used by the Gestapo during World War Two as a torture chamber.

As fighting raged for hours, protesters threw homemade bombs made from gas canisters as riot police advanced across the square on the crowds, firing tear gas and stun grenades. Loud booms from the protests could be heard inside parliament.

After days of dire warnings and threats of rebellion, parliament began debating a bill setting out 3.3 billion euros ($4.4 billion) in wage, pension and job cuts this year alone, to secure funds Greece needs to avoid bankruptcy next month.

Venizelos told parliament that the alternative to the international bailout - bankruptcy and a departure from the euro zone - would be far worse for Greeks.

The choice is not between sacrifice and no sacrifices at all, but between sacrifices and unimaginably harsher ones, he told a stormy debate expected to run well into the night.

One small party has already pulled out of the coalition in protest against the terms of the rescue package from the European Union and International Monetary Fund - Greece's second since 2010.

A number of lawmakers from the two biggest government parties, socialist PASOK and conservative New Democracy, have also threatened to rebel but their numbers did not appear to be enough to sink the bill.

Greece needs the international funds before March 20 to meet debt repayments of 14.5 billion euros, or suffer a chaotic default which could shake the entire euro zone.

GREEKS HAVE RISEN!

Many Greeks believe their living standards are collapsing already and the new measures, which include a 22 percent cut in the minimum wage, will only deepen their misery.

Enough is enough! said 89-year-old Manolis Glezos, one of Greece's most famous leftists. They have no idea what an uprising by the Greek people means. And the Greek people, regardless of ideology, have risen.

Glezos is a national hero for sneaking up the Acropolis at night in 1941 and tearing down a Nazi flag from under the noses of the German occupiers, raising the morale of Athens residents.

These measures of annihilation will not pass, Glezos said on Syntagma Square, visibly overcome by teargas and holding a mask over his mouth.

As is usual in Greek protests, only a small fraction of the crowd fought the police but one group started a fire right in front of a tent where first aid workers were preparing to care for the injured. Cops, pigs, murderers! chanted the crowd.

The Health Ministry said 54 people were taken to hospital, including one who was hit in the stomach by a flare. At least eight police were also injured.

Inside parliament, Venizelos said: Anyone who wants to remain in the euro zone must abide by some rules.

The law must be passed by midnight because come Monday morning, the banking and financial markets must have got the message that Greece can and wants to survive.

SHRINKING REBELLION?

The bill has riven the ruling coalition and deepened a social crisis among Greeks already hit by cuts and tax hikes to ease the country's huge debt burden.

During the debate a Communist Party deputy hurled the pages of the bill on the floor of the chamber and in fiery exchanges Venizelos warned lawmakers: If the law is not passed, the country will go bankrupt.

A BOTTOMLESS PIT

The EU and IMF say they have had enough of broken promises and that the funds will be released only with the clear commitment of Greek political leaders that they will implement the reforms whoever wins an election potentially in April.

Euro zone paymaster Germany ratcheted up the pressure on Sunday. The promises from Greece aren't enough for us anymore, German Finance Minister Wolfgang Schaeuble said in an interview published on Sunday in Welt am Sonntag newspaper.

German opinion polls show a majority of Germans are willing to help, Schaeuble said, but it's important to say that it cannot be a bottomless pit.

Greece needs to do its own homework to become competitive, whether that happens in conjunction with a new rescue program or by another route that we actually don't want to take.

When asked if that other route meant Greece quitting the euro zone, Schaeuble said: That is all in the hands of the Greeks themselves. But even in the event (Greece leaves the euro zone), which almost no one assumes will happen, they will still remain part of Europe.

The austerity measures include cutting the minimum wage from about 750 euros a month and aim to cut Greece's bloated state sector workforce by about 150,000 people by 2015.

It also provides for a bond swap to ease Greece's debt burden by cutting the real value of private-sector investors' bond holdings by some 70 percent. Greece will miss a February 17 deadline to offer a debt haircut to private bondholders if the vote is not passed on Sunday.