It was the latest sign that Prime Minister Recep Tayyip Erdogan’s government may have run out of patience after 12 days of unrest in Turkey’s largest city and beyond. Earlier in the day, he accused the protesters of sullying Turkey’s image, raising the possibility that he had ordered police to show no restraint in clearing Taksim Square.

In the chaos of a confrontation that began about 8:45 p.m., several fires burned in the square and protesters exploded fireworks, threw stones and waved banners.

As a phalanx of helmeted officers moved forward, water cannons doused a man in a wheelchair carrying a Turkish flag. Plainclothes officers in gas masks yanked down banners.

For the police, the marching orders appeared to be: fire tear gas, advance, spray water cannons and peel back. Then, after the tear gas dissipated in the wind, the protesters again stepped into the void — clanging fences, shooting fireworks, and erecting makeshift barricades.

At one point, they set alight a huge bonfire in the middle of the square.

Several people were being placed into ambulances during the clashes, which have trained an international spotlight on Turkey’s democracy.

The protests have swelled from a peaceful demonstration first aimed to stop developers from cutting down trees in a park into nationwide disturbances.

Earlier Tuesday, many of the protesters in Istanbul had fled into the adjacent Gezi Park, where hundreds have been camping out to stop developers from cutting down trees in the park. As police moved in, bulldozers began demolishing the barricades and the makeshift shelters.

At the same time, Erdogan made it clear in Ankara, the capital, that he had come to the end of his patience with the protesters.

‘‘To those who ... are at Taksim and elsewhere taking part in the demonstrations with sincere feelings, I call on you to leave those places and to end these incidents, and I send you my love. But for those who want to continue with the incidents I say: ‘It’s over.’ As of now we have no tolerance for them,’’ Erdogan said.

‘‘Not only will we end the actions, we will be at the necks of the provocateurs and terrorists, and no one will get away with it,’’ he added.

The unrest — which has spread to 78 cities across Turkey — has been inspired in part by what some see as Erdogan’s increasingly authoritarian style of governing and his perceived attempts to impose a religious and conservative lifestyle in a country with secular laws.

Erdogan, a devout Muslim, says he is committed to Turkey’s secular laws and denies charges of autocracy. Yet as he defended his tough stance, he gave critics little hope of a shift in his position.

‘‘Were we supposed to kneel before them and say please remove your pieces of rags? They can call me harsh, but this Tayyip Erdogan won’t change,’’ he said.

He was referring to the banners and posters that activists had hung from a building and a monument at Taksim Square, which police removed.

Erdogan spoke before a meeting with President Abdullah Gul to discuss the protests, their first since they erupted. Contrary to Erdogan, Gul has defended people’s rights to express democratic rights.

Selin Akuner, a volunteer at a makeshift infirmary at Gezi Park, said some 300 people had sought treatment, mostly for the effects of tear gas. Nearly 50 people had been hit by rubber bullets or gas canisters, 12 had head traumas and about eight had injured legs or arms, she said.

The governor’s office said one demonstrator and one police officer were hospitalized.

Erdogan has called for major pro-government rallies to be held in Ankara and Istanbul this weekend.

‘‘We are not trying to say look we are greater, we are more populous. We are going to the rallies to ensure that the voice of silent masses is heard,’’ he said.

The government announced late Monday that Erdogan would meet with some of the Gezi Park protesters on Wednesday, but that authorities would not allow the ‘‘illegal’’ demonstrations to continue.