Protesters and Turkey’s prime minister both refused to back down Tuesday in what could become the final battle for Istanbul’s Taksim Square, the symbol of nationwide grievances against the government.

Tens of thousands of protesters returned to the square in the evening, in a show of defiance met with tear gas, rubber bullets and water cannons, hours after riot police had forced their way past improvised barricades to clear the square of protesters occupying the area for the past 12 days.

Hundreds more vowed to continue their sit-in at Taksim’s adjacent Gezi Park, despite an order from Prime Minister Recep Tayyip Erdogan for them to leave — an order bolstered by the police show of force.

A peaceful demonstration against the park’s redevelopment that began two weeks ago has turned into the biggest test of Erdogan’s authority in his decade in power.

The unrest has spread to 78 cities across the country, with protesters voicing their objections to what they say is the prime minister’s increasingly authoritarian style and his perceived attempts to impose a religious and conservative lifestyle in a country with secular laws — charges he rejects.

Four people have died, including a police officer, and about 5,000 have been treated for injuries or the effects of tear gas, according to the Turkish Human Rights Foundation.

Tuesday’s clashes, which saw police and protesters take and lose control of the square several times, came a day after the smallest gathering in Taksim since the demonstrations began, sparked by a violent police reaction against the initial sit-in in the park. The government had also said this week that Erdogan would meet with some of those occupying the park on Wednesday to hear their views.

“The relative calm yesterday was deceptive,” said Robert O’Daly, Turkey analyst for the Economist Intelligence Unit. “Mr. Erdogan’s offer of dialogue appears to have been merely tactical. The appearance of riot police in the square this morning and renewed use of tear gas against the protesters fits better with his defiant rhetoric.”

Erdogan, an observant 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’?” he said Tuesday, referring to the dozens of banners and flags the protesters had strung in the square. “They can call me harsh, but this Tayyip Erdogan won’t change.”

Confident of his position of power after winning the last elections in 2011 with 50 percent of the vote, Erdogan has made it clear that he has come to the end of his patience with the protesters, whom he accused of sullying Turkey’s image abroad and being vandals and troublemakers.

“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.”

“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.

Erdogan, who has called major pro-government rallies in Ankara and Istanbul for this weekend, insisted again that the unrest was part of a conspiracy against his government.

The demonstrators, he said, “are being used by some financial institutions, the interest rate lobby and media groups to [harm] Turkey’s economy and [scare away] investments.”

In Taksim, unrest continued into the night. The tens of thousands of protesters who returned in the evening were met with more rounds of tear gas, which was also fired into the park. Students clutching surgical masks, women in summer dresses and sandals, and boys selling gas masks ran through the trees for cover from the plumes of acrid chemicals that spewed out of canisters fired by riot police.

Istanbul Gov. Huseyin Avni Mutlu asked peaceful protesters to stay away from Taksim until it was cleared of “marginal groups.” He said 30,000 to 35,000 people had gathered as police stood by.

Ambulances ferried away the injured. Before the evening clashes, more than 300 people had been treated in a makeshift infirmary set up in the park, most for the effects of tear gas, said volunteer Selin Akuner. Twelve had suffered head injuries.

But as night fell to the echoes of exploding tear gas canisters in Taksim, few protesters appeared willing to leave.

— Associated Press

Fraser reported from Ankara.