By Ralph Boulton and Parisa Hafezi
ISTANBUL/ANKARA (Reuters) - Prime Minister Tayyip Erdogan warned protesters who have taken to the streets across Turkey demanding his resignation that his patience has its limits and compared the unrest with an army attempt six years ago to curb his power.
Riot police used teargas and water cannon to disperse anti-government protesters from a square in the capital, Ankara, just a few kilometers from where Erdogan spoke.
He held six rallies on Sunday, a measure of tensions after a week of the biggest demonstrations and worst rioting of his decade in power. Thousands waved red Turkish flags and shouted Allahu Akbar (God Is Greatest) as he accused protesters of attacking women wearing headscarves and desecrating mosques by taking beer bottles into them.
"I believe in Erdogan and his path. We will not let some looters hijack our country and our flag," said a housewife who gave her name as Zeynep, waving a national flag with Erdogan's picture emblazoned on it.
In the commercial center Istanbul, tens of thousands flooded the central Taksim Square, where protests began nine days ago when police used teargas and water cannon against a peaceful demonstration over plans to build on a park there. Many see Turkey's secular order threatened by Erdogan.
Protesters, many camped out in tents, now control a large area around the square, with approach roads barricaded by masonry, paving stones and steel rods. Police have withdrawn completely from the area, water cannon kept hundreds of meters away by the side of the Bosphorus waterway.
Western countries have held up Erdogan's Turkey as an example of an Islamic democracy that could be emulated elsewhere in the Middle East. Violent police action, however, has drawn criticism from the West and Erdogan has increasingly accused foreign forces of trying to aggravate the troubles.
He also rounded on speculators, foreign and domestic, in the country's capital markets, vowing to "choke" those who he said were growing rich off "the sweat of the people", and urging Turks to put their money in state not private banks.
"Those who attempt to sink the bourse, you will collapse ... If we catch your speculation, we will choke you. No matter who you are, we will choke you," he said.
Turkey's financial markets were turbulent last week and investors are preparing for more volatility this week.
Early on Friday, the lira hit its weakest point against its euro/dollar basket since October 2011, while Istanbul's main share index lost around 15 percent over the week. The yield of Turkey's two-year benchmark sovereign bond hit a six-month high on Thursday.
Three people have been killed and around 5,000 injured in the troubles rocking a country faced with war across its southern border with Syria.
"We were patient, we will be patient, but there is an end to patience, and those who play politics by hiding behind the protesters should first learn what politics means," Erdogan said, in one of his most strongly worded speeches since the troubles began.
Erdogan did not specify who he thought was 'hiding behind the protesters'; but one of his proudest achievements has been in combating a conservative secularist establishment, especially an army that had toppled four governments in four decades.
Erdogan, who critics say has become authoritarian after three election victories in a row, compared the troubles with a confrontation with the army that became known as the "e-Coup".
"Today, we are exactly where we were on April 27, 2007."
On that date, the army issued a memorandum on its website denouncing plans to have Abdullah Gul, co-founder with Erdogan of the AK Party, appointed as president. The move would give AKP broad control over the state apparatus and the generals suggested they could act to stop it in defense of secularism.
Erdogan's government had been expected, like others before it, to bow to the will of the military. But it faced down the army, chided it publicly for its intervention and went ahead with Gul's appointment.
It was a definitive moment in relations with the military, many of whose top generals have since been jailed after investigation of alleged coup plots against Erdogan.
The Ergenekon plot had hinged on stirring widespread protests throughout Turkey and public disorder, followed then by bombings and assassinations that would clear the way for an army takeover to restore order.
Erdogan clearly feels there are potentially powerful forces still ranged against him.
Underscoring the drama of the moment, Erdogan, who denies Islamist ambitions for Turkey, made reference to two of his political models - former prime minister Adnan Menderes, hanged after a 1960 coup, and Turgut Ozal, a reforming president who some believe was poisoned to death.
"My beloved brothers, we're walking towards a better Turkey. Don't allow those who attempt to plant divisive seeds to do so," Erdogan said at another speech in the southern city of Adana on Sunday, from atop of a bus emblazoned with his picture and the AK Party's slogan, "Big Country, Big Power".
(Editing by Nick Tattersall and Andrew Heavens)