ISTANBUL — Thousands of demonstrators squared off against riot police on Tuesday and defiantly packed an Istanbul square after Turkish Prime Minister Recep Tayyip Erdogan warned he had "no more tolerance" for the mass protests against his Islamic-rooted government.

Hundreds of police stormed Taksim Square, the epicentre of nearly two weeks of unrest, in the early morning, firing tear gas and jets of water. They fought hours-long battles with protesters and used bulldozers to clear the barricades erected by demonstrators after police pulled out of the area on June 1.

For most of the day clouds of acrid smoke filled the square as the clashes raged, with some demonstrators, in helmets and gas masks, hurling molotov cocktails, fireworks and stones.

But as evening fell, police unexpectedly retreated and lined up along the eastern side of the square only, allowing whistle-blowing demonstrators to flood the area for a 12th night, many chanting: "Resistance!" and booing at officers.

In the capital Ankara, which has seen several nights of violence, crowds also took to the streets, an AFP photographer saw.

The early morning police intervention in Taksim Square surprised protesters, many of whom were still dozing in nearby Gezi Park, because it came just hours after Erdogan said he would meet with protest leaders on Wednesday, his first major concession since the trouble began.

But the premier made no mention of the olive branch Tuesday and resumed his tough stance against the demonstrators who have thrown up the biggest challenge yet to his decade-long rule.

"This episode is now over. We won't show any more tolerance," the premier told cheering lawmakers of his Justice and Development Party (AKP) in a speech broadcast live on television.

"Can you believe that? They attack Taksim, gas us in the morning just after proposing talks with us?" said 23-year-old Yilmaz.

"We won't abandon Gezi," he vowed. "I am not afraid of their water cannon, it'll be my first shower in three days."

The nationwide unrest first erupted after police cracked down heavily on May 31 on a campaign to save Gezi Park from redevelopment.

The trouble spiralled into mass displays of anger against Erdogan, who is seen as increasingly authoritarian, tarnishing Turkey's image as a model of Islamic democracy.

Erdogan said on Tuesday that four people, including a policeman, had died. Nearly 5,000 people have been injured.

-- Taksim 'tarnishing Turkey image' --

In a rousing speech to lawmakers, Erdogan urged "sincere" protesters in Gezi Park to pull back, warning that their environmental campaign was being hijacked by "an illegal uprising against the rule of democracy".

In a symbolic gesture, police removed anti-Erdogan banners from a building overlooking Taksim and replaced them with a single Turkish flag and a large portrait of Mustafa Kemal Ataturk, the father of modern Turkey, whose image has also been adopted by the protesters.

Istanbul governor Huseyin Avni Mutlu sought to justify the intervention, saying the protesters' takeover of Taksim Square "tarnished the country's image before the eyes of the world", and assured demonstrators police would not storm Gezi Park.

Opponents accuse Erdogan of repressing critics -- including journalists, minority Kurds and the military -- and of pushing conservative Islamic values on the mainly Muslim but constitutionally secular nation.

But the 59-year-old, in power since 2002, remains the country's most popular politician. His AKP has won three elections in a row and took nearly half the vote in the 2011 polls, having presided over strong economic growth.

The premier has urged loyalists to respond to the demonstrators by voting for the AKP in local polls next year.

The first campaign rallies will be staged in Ankara and Istanbul next weekend and are expected to bring tens of thousands of party faithful onto the pavements.

At least 18 people were injured in Tuesday's violence, medical officials said, reporting numerous broken bones and several head injuries.

Elsewhere in the city, over 70 lawyers were arrested after gathering at a city courthouse to object to the police operation, the Contemporary Lawyers' Association said.

Protesters said Tuesday's crackdown had made them lose in faith in the prospect of dialogue with Erdogan.

Taksim Solidarity, the core group behind the campaign to save Gezi Park, accused the premier of "polarising" the public.

Turkey, a country of 76 million at the crossroads of East and West, is a key strategic partner in the region for the United States and other Western allies. Many of them have criticised Erdogan's handling of the crisis.

Watch live, broadcast via NBC News on June 11.