By Michele Kambas and Lefteris Papadimas

ATHENS (Reuters) - Tens of thousands of Greeks took to the streets on Friday in rival rallies that laid bare the deep divide heading into a referendum that may decide the country’s future in Europe’s single currency.

Prime Minister Alexis Tsipras, elected in January on a promise to end years of austerity, urged people packing Syntagma square in central Athens to spurn the tough terms of an aid deal offered by international creditors to keep the country afloat.

His European partners say a 'No' vote will jeopardize Greece’s membership of the euro.

Tsipras says they are bluffing, fearing the fallout for Europe and the global economy. A 'Yes' vote may bring him down, ushering in a new period of political instability for a country reeling from five days of shuttered banks and rationed cash withdrawals.

Framing Sunday’s ballot as a battle for democracy, freedom and European values, the 40-year-old left-wing leader told Greeks to “turn your backs on those who terrorize you daily”.

“On Sunday, we are not just deciding that we are staying in Europe, but that we are deciding to live with dignity in Europe,” he told the crowd of at least 50,000.

His opponents accuse Tsipras of gambling Greece’s future on a rapid-fire plebiscite that a major European rights watchdog says falls short of international standards of fairness.

Four opinion polls published on Friday had the 'Yes' vote marginally ahead; a fifth put the 'No' camp 0.5 percent in front, but all were well within the margin of error.

"We know that the lenders will close the door if we say no, but we must fight,” said 65-year-old pensioner Irini Stavridou, who attended the 'No' rally.

“We must fight not only for Greece but all the people in Europe, for those who just have a different opinion."





ODE TO JOY

On Syntagma, patriotic songs blared out over loudspeakers. At the 'Yes' camp, thousands rallied in front of the old Olympic Stadium to Beethoven’s "Ode to Joy," the anthem of the European Union. There appeared to be fewer people than in the 'No' crowd.

"I prefer to vote ‘Yes’, have a few more years austerity and give my child a better future,” said unemployed economist Marina Peppa, 45. “It’s not going to be easy, but if ‘No’ prevails we’ll have Armageddon, total poverty.”

With tension building, police fired stun grenades and briefly scuffled with a few dozen black-clad people carrying red flags, often carried by anti-establishment radicals. The violence appeared to be isolated.

In a televised address earlier in the day, Tsipras seized on a report by the International Monetary Fund – which argued that Greece's massive public debt could not be sustained without significant writedowns – as vindication of his rejection of the lenders’ terms.

Finance Minister Yanis Varoufakis called the IMF report "music to our ears". Regardless of the outcome of the referendum, Greece will need some 50 billion euros as well as a massive debt writedown, the report said.

European policy makers, however, issued fresh warnings of the costs of a 'No' vote in a plebiscite called with just eight days' notice after the breakdown of talks with the European Commission, the IMF and the European Central Bank.

Commission President Jean-Claude Juncker and German Finance Minister Wolfgang Schaeuble dismissed Tsipras' argument that his government would be able to move smoothly to negotiate more favorable terms if Greeks backed his rejection.

"If the Greeks will vote 'No', the Greek position is dramatically weakened," Juncker told a news conference.





BRINKMANSHIP

Tsipras is betting Europe will compromise rather than let Greece slip out of the euro zone. But behind the rhetoric, there were more concrete signs of the pressure Europe can exert on Greece.

The euro zone's rescue fund, Greece's largest creditor, said it was reserving the right to call in 130.9 billion euros of debt ahead of time after Athens defaulted on an IMF loan.

With banks shuttered all week, cash withdrawals rationed and commerce seizing up, Sunday’s ballot could decide whether Greece gets another last-ditch financial rescue in exchange for more harsh austerity measures or plunges deeper into economic crisis.

One in four Greek workers are jobless; the economy has shrunk by a quarter since 2009.

Story continues