ANKARA, Turkey -- ANKARA, Turkey (AP) - Turkey's president on Monday defended the right of citizens to protest, in strong contrast to the dismissive stance of the prime minister, as police used tear gas for a fourth day in an attempt to disperse demonstrations that grew out of a sit-in to prevent the uprooting of trees at Istanbul's main square.

Turkey has been hit by demonstrations since Friday sparked by anger over excessive police force against protesters holding a sit-in against redevelopment of Istanbul's main Taksim Square.

The demonstrations spiraled into Turkey's biggest anti-government disturbances in years, challenging Prime Minister Recep Tayyip Erdogan's power. The protests were seen as a display of frustration against Erdogan, who has appeared to be increasingly authoritarian and is accused of meddling in all aspects of life.

Erdogan, who has been in power since 2003 having won three landslide elections, inflamed tensions by calling protesters "a bunch of looters" and by branding them a "minority" trying to force demands on his majority.

On Monday, Erdogan again dismissed the street protests as being organized by extremists, described them as a temporary blip and angrily rejected comparisons with the Arab Spring uprisings.

Appearing defensive and angry, he lashed out at reporters who asked whether the government had understood "the message" by protesters or whether he would soften his tone.

"What is the message? I want to hear it from you," Erdogan retorted.

"What can a softened tone be like? Can you tell me?" he said. He spoke to reporters before leaving on what was planned to be a four-day trip to Morocco, Algeria and Tunisia.

The demonstrators, mostly secular-minded Turks, took to the street airing frustrations at Erdogan's abrasive and non-compromising style as well as the heavy-handed police response to protests. Some of the protesters clashed with police, but most of the protesters demonstrated peacefully, chanting calls for Erdogan to resign. Those who did not take to the streets banged on pots and pans from windows and balconies.

"When we speak of democracy, of course the will of the people is above all," Gul said. "But democracy does not mean elections alone."

"There can be nothing more natural for the expression of various views, various situations and objections through a variety of ways, besides elections," he said.

He added: "The views that are well intentioned have been read, seen and noted and the messages have been received."

There was scattered violence in areas close to Erdogan's offices in Istanbul and in Ankara. The Dogan news agency said police fired tear gas at the group in an area close to Erdogan's Istanbul office. The protesters responded by hurling stones.

The agency said as many as 500 people were detained overnight Monday after police clashed with more militant protesters and then moved in to break up several thousands of people demonstrating peacefully. Turkey's Fox television reported 300 others detained in a similar crackdown in Izmir, Turkey's third-largest city.

Social media were awash with reports and videos of police abuse. Authorities have said police excesses would be investigated, but they appeared to continue unabated.

Fox showed footage of police telling a group sheltering by the side of a building to come out, reassuring that nothing would happen, then shooting a gas canister at one of them.

A group of protesters took control of a large earth digger near the area and drove it toward police water cannon, Dogan news agency footage showed. Medics were seen tending to people injured in the skirmishes or affected by gas at a mosque close to the palace.

Erdogan described some of the protesters as "naive, decent and participating (in demonstrations) by following information on social media" but claimed the protests were being organized by Turkey's opposition party and extremist groups.

He also blamed the protest on "internal and external" groups bent on harming Turkey, said the country's intelligence service was working on identifying them and threatened to hit back at them.

"We shall be discussing these with them and will be following up, in fact we will also settle accounts with them," he said.

Turkey's main stock exchange has dropped by 6.43 percent on opening on Monday, as investors worried about the destabilizing effect of the demonstrations on the economy.

Erdogan played down its significance, saying: "It's the stock market, it goes down and it goes up. It can't always be stable."

He rejected any comparison to the Arab Spring uprisings.

"We already have a spring in Turkey," alluding to the nation's free elections. "But there are those who want to turn this spring into winter.

"Be calm, these will all pass," he said.

In Iraq meanwhile, Prime Minister Nouri al-Maliki said in comments posted on his official website that his government was worried about the security implications of the situation in Turkey, saying the country was "an essential part of the stability of the region."

"We believe that resorting to violence will widen the circle (of violence) ... in the region, and we call for restraint," he said.

Iraq and Turkey share a long, mountainous border. Iraq is home to an ethnic Turkomen minority, centered around the disputed Iraqi city of Kirkuk, whose well-being has long been a concern for Ankara.

The two countries' relationship is increasingly strained over growing Turkish ties to Iraq's largely autonomous northern Kurdish region, and over Turkey's support for the Sunni rebels fighting to topple the Syrian regime. The Syrian civil war is exacerbating sectarian divisions within Iraq, and Baghdad has warned that the fall of the Iranian-backed Syrian government could ignite a wider conflict in the region.

__

Associated Press writer Adam Schreck in Baghdad contributed to this report.

Related on HuffPost:

Loading Slideshow...
  • Turkish protesters clash with Turkish riot policemen on Taksim square in Istanbul on June 22, 2013. Turkish police used water cannon today to disperse thousands of demonstrators who had gathered anew in Istanbul's Taksim Square, calling for the resignation of Prime Minister Recep Tayyip Erdogan. (BULENT KILIC/AFP/Getty Images)

  • Protesters hold up their hands as they gather on Taksim square before clashes with Turkish riot police in Istanbul on June 22, 2013 during a wave of new protests. (BULENT KILIC/AFP/Getty Images)

  • Protesters hold up their hands as they gather on Taksim square before clashing with Turkish riot police in Istanbul on June 22, 2013. (BULENT KILIC/AFP/Getty Images)

  • A man bleeds from a head wound as Turkish police clash with anti-government protestors while they clear Taksim Square and push them down the Istikhlal shopping avenue on June 22, 2013 in Istanbul, Turkey. (Photo by Scott Peterson/Getty Images)

  • A man braces against a shield as Turkish police clash with anti-government protestors while they clear Taksim Square and push them down the Istikhlal shopping avenue on June 22, 2013 in Istanbul, Turkey. (Photo by Scott Peterson/Getty Images)

  • An anti goverment protestor waves a Turkish flag with a portrait of Mustafa Kemal Ataturk, founder of modern Turkey on Taksim square during the clash between riot Police and protestors in Istanbul on June 22, 2013. (OZAN KOSE/AFP/Getty Images)

  • Protesters raise their hands as they gather on Taksim square during the clash between riot police and protestors in Istanbul on June 22, 2013. (OZAN KOSE/AFP/Getty Images)

  • Cyclists ride bikes during the silent protest at Taksim Square on June 23, 2013 in Istanbul, Turkey. Performance artist Erdem Gunduz, nicknamed 'The Standing Man,' became a new symbol of the anti-government protests after a eight-hour vigil in Taksim Square. (Photo by Burak Kara/Getty Images)

  • Turkish anti-government protestors gather in Taksim Square carrying carnations to mark the four people killed in weeks of protest on June 22, 2013 in Istanbul, Turkey. (Photo by Scott Peterson/Getty Images)

  • Turkish anti-government protestors push back on a police car, carnations sitting to mark the four people killed in weeks of protest, as police move into clear Taksim Square in Istanbul, on June 22, 2013 in Istanbul, Turkey. (Photo by Scott Peterson/Getty Images)

  • Turkish anti-government protestors gather in Taksim Square carrying carnations to mark the four people killed in weeks of protest on June 22, 2013 in Istanbul, Turkey. (Photo by Scott Peterson/Getty Images)

  • Turkish riot police argue with anti-government protestors as they begin moving in to clear Taksim Square, on June 22, 2013 in Istanbul, Turkey. (Photo by Scott Peterson/Getty Images)

  • People stand during a silent protest at Taksim Square on June 23, 2013 in Istanbul, Turkey. Performance artist Erdem Gunduz, nicknamed 'The Standing Man,' became a new symbol of the anti-government protests after a eight-hour vigil in Taksim Square. (Photo by Burak Kara/Getty Images)

  • People stand during a silent protest at Taksim Square on June 23, 2013 in Istanbul, Turkey. Performance artist Erdem Gunduz, nicknamed 'The Standing Man,' became a new symbol of the anti-government protests after a eight-hour vigil in Taksim Square. (Photo by Burak Kara/Getty Images)

  • A protester reacts in pain to a salvo of tear gas fired by Turkish riot police officers to chase out demonstrators and to dismantle the tent camp set up by demonstrators in Gezi Park in Istanbul on June 15, 2013. (MARCO LONGARI/AFP/Getty Images)

  • People light candles for the victims of the protests at Taksim square, in Istanbul, early Saturday, June 15, 2013. (AP Photo/Vadim Ghirda)

  • Protesters try to resist the advance of riot police in Gezi park in Istanbul, Turkey, Saturday, June 15, 2013. (AP Photo/Vadim Ghirda)

  • A protester reacts as police throw tear gas among tents during an operation to evacuate the Gezi Park of Taksim Square in Istanbul, Saturday, June 15, 2013. (AP Photo/Thanassis Stavrakis)

  • Police enter to evacuate the Gezi Park in Istanbul, Saturday, June 15, 2013. (AP Photo/Thanassis Stavrakis)

  • Protesters try to resist the advance of riot police in Gezi park in Istanbul, Turkey, Saturday, June 15, 2013. (AP Photo/Vadim Ghirda)

  • People march from Anatolian side to European side to Taksim square in Istanbul, on June 16, 2013. (BULENT KILIC/AFP/Getty Images)

  • Protesters take cover from a water cannon during clashes with riot police at a demonstration in Ankara on June 16, 2013. (ADEM ALTAN/AFP/Getty Images)

  • A pretzel vendor walks in front of a line of Turkish police cordoning off Taksim Square, in Istanbul, Turkey, Sunday, June 16, 2013. (AP Photo/Vadim Ghirda)

  • A protester reacts as Turkish riot police spray water cannon at demonstrators who remained defiant after authorities evicted activists from an Istanbul park, making clear they are taking a hardline against attempts to rekindle protests that have shaken the country, in city's main Kizilay Square in Ankara, Turkey, Sunday, June 16, 2013. (AP Photo/Burhan Ozbilici)

  • As police vehicles rolled into Kizilay Square, one woman approached a lightly armored truck bearing the logo of the police anti-terrorism department and grabbed a side window to ask those inside: "What is this oppression? Have you no fear of God? I have no children, but all of these (demonstrators) are my children!" she said, motioning to the young protesters nearby, in Ankara, Turkey, Sunday, June 16, 2013. (AP Photo/Burhan Ozbilici)

  • A protester reacts as Turkish riot police spray water cannon at demonstrators who remained defiant after authorities evicted activists from an Istanbul park, making clear they are taking a hardline against attempts to rekindle protests that have shaken the country, in city's main Kizilay Square in Ankara, Turkey, Sunday, June 16, 2013. (AP Photo/Burhan Ozbilici)

  • In this Saturday, June 15, 2013, file photo, protesters try to resist the advance of riot police in Gezi park in Istanbul, Turkey. (AP Photo/Vadim Ghirda, File)

  • Turkish protesters hold a massive rally on John F. Kennedy street near the U.S. Embassy, shouting slogans such as "government, resign!" in Ankara, Turkey, early Sunday, June 16, 2013. (AP Photo/Burhan Ozbilici)

  • In this Tuesday, June 11, 2013, file photo, a protester tries to remain standing as a police water cannon fires water during clashes in Taksim square in Istanbul. (AP Photo/Kostas Tsironis, File)

  • In this Tuesday, June 11, 2013, file photo, a protester tries protect from water projected by a water canon from police during clashes in Taksim square in Istanbul. (AP Photo/Kostas Tsironis)

  • People carry the coffin of Ethem Sarisuluk, one of five people killed during the recent protests in Turkey, as Turkish riot police spray water cannon at demonstrators who remained defiant after authorities evicted activists from an Istanbul park, making clear they are taking a hardline against attempts to rekindle protests that have shaken the country, in city's main Kizilay Square in Ankara, Turkey, Sunday, June 16, 2013. (AP Photo )

  • Police fire tear gas as riot police spray water cannon at demonstrators who remained defiant after authorities evicted activists from an Istanbul park, making clear they are taking a hardline against attempts to rekindle protests that have shaken the country, near city's main Taksim Square in Istanbul, Turkey, Sunday, June 16, 2013.(AP Photo )

  • Anti-government protesters demonstrate in central Ankara on June 17, 2013. (ADEM ALTAN/AFP/Getty Images)

  • Anti-government protesters demonstrate in central Ankara on June 17, 2013. (ADEM ALTAN/AFP/Getty Images)

  • People walk during a rally by the labor unions in Istanbul, Turkey, Monday, June 17, 2013. (AP Photo)

  • People shout anti-government slogans during a rally by the labor unions in Istanbul, Turkey, Monday, June 17, 2013. (AP Photo)

  • Erdem Gunduz, right, stands silently on Taksim Square in Istanbul, Turkey, early Tuesday, June 18, 2013. (AP Photo)

  • A protester stands in a silent protest at Taksim Square in, Istanbul, Turkey, Tuesday, June 18, 2013. After weeks of sometimes-violent confrontation with police, Turkish protesters have found a new form of resistance: standing still and silent. (AP Photo/Petr David Josek)

  • Mert Solkiran, centre, stands in a silent protest at Taksim Square in, Istanbul, Turkey, Tuesday, June 18, 2013. After weeks of sometimes-violent confrontation with police, Turkish protesters have found a new form of resistance: standing still and silent. (AP Photo/Petr David Josek)

  • Erdem Gunduz, left, and dozens of people stand silently on Taksim Square in Istanbul, Turkey, early Tuesday, June 18, 2013. After weeks of confrontation with police, sometimes violent, Turkish protesters are using a new form of resistance: standing silently. The development started late Monday when a solitary man began standing in passive defiance against Prime Minister Recep Tayyip Erdogan's authority at Istanbul's central Taksim Square. The square has been sealed off from mass protests since police cleared it over the weekend. The man has identified himself as Erdem Gunduz, a performance artist. His act has sparked imitation by others in Istanbul and other cities. It has provoked widespread comment on social media. (AP Photo)

  • Protestors stand in a silent protest at Taksim Square in, Istanbul, Turkey, Tuesday, June 18, 2013. After weeks of sometimes-violent confrontation with police, Turkish protesters have found a new form of resistance: standing still and silent. (AP Photo/Petr David Josek)

  • A man sleeps at Taksim's Gezi Park early on June 12, 2013 in Istanbul, hours after riot police invated the square. (ANGELOS TZORTZINIS/AFP/Getty Images)

  • Demonstrators wait at the entrance of Taksim Gezi park on June 12, 2013. (GURCAN OZTURK/AFP/Getty Images)

  • Turkish lawyers march in support of anti-government protests in Ankara, on June 12, 2013. (AFP/Getty Images)

  • Demonstrators wait at the entrance of the Taksim Gezi park on June 12, 2013 after a night of running battles with riot police as Turkish Prime Minister moved to crush mass demos against his Islamic-rooted government. (GURCAN OZTURK/AFP/Getty Images)

  • Lawyers and members of the Turkish bar association shout slogans as they march in support of anti-government protests in Ankara, on June 12, 2013. (STRINGER/AFP/Getty Images)

  • Turkish lawyers march in support of anti-government protests in Ankara, on June 12, 2013. (AFP/Getty Images)

  • Riot police fire tear gas to disperse the crowd during a demonstration near Taksim Square on June 11, 2013 in Istanbul, Turkey. (Photo by Lam Yik Fei/Getty Images)

  • Protesters clash with riot police at Taksim square in Istanbul on June 11, 2013. (ARIS MESSINIS/AFP/Getty Images)

  • Riot police fire tear gas to disperse the crowd during a demonstration near Taksim Square on June 11, 2013 in Istanbul, Turkey. (Photo by Lam Yik Fei/Getty Images)

  • An injured person is helped by fellow protesters during clashes with police on Taksim square in Istanbul, on June 11, 2013. (BULENT KILIC/AFP/Getty Images)