At least 300,000 secular Turks waving the red national flag flooded central Istanbul on Sunday to demand the resignation of the pro-Islamic government.
The second large anti-government demonstration in two weeks, it followed a sharp rise in tension between Prime Minister Recep Tayyip Erdogan and the country's powerful pro-secular military, which accuses the government of tolerating the activities of radical Islamic circles.
"Turkey is secular and will remain secular," shouted thousands of flag-waving protesters, who traveled to Istanbul from across the country overnight.
The demonstrators sang nationalist songs and demanded the resignation of the government, calling Erdogan a traitor.
"This government is the enemy of Ataturk," said 63-year-old Ahmet Yurdakul, a retired government employee, invoking the memory of Mustafa Kemal Ataturk, who founded the modern republic as a secular nation. "They want to drag Turkey to the dark ages.
The packed meeting area in the Caglayan district was a sea of red, with Turkish flags draped on people like capes and hung from cars, motorcycles and buildings.
Small girls wore red headbands that read "We are following your footsteps," in reference to Ataturk.
Police cordoned off the area and conducted body searches at several entry points.
More than 300,000 took part in a similar rally in Ankara two weeks ago.
This one was organized more than a week ago, but it came a day after Erdogan's government rejected the military's warning about the country's disputed presidential election and called it interference that is unacceptable in a democracy.
The ruling party candidate, Foreign Minister Abdullah Gul, failed to win a first-round victory Friday in a parliamentary presidential vote marked by tensions between secularists and the pro-Islamic government. Most opposition legislators boycotted the vote and challenged its validity in the Constitutional Court.
The military said Friday night that it was gravely concerned and indicated it was willing to become more openly involved in the process — a statement some interpreted as an ultimatum to the government to rein in officials who promote Islamic initiatives.
"The roads to Cankaya [the presidential palace] are closed to imams," the crowd chanted.
Some said Parliament Speaker Bulent Arinc was an enemy of the secular system, because he said the next president should be "pious."
In the 1920s, with the Ottoman Empire in ruins, Ataturk set about a series of secular reforms that imposed Western laws, replaced Arabic script with the Latin alphabet, banned Islamic dress and granted women the right to vote.
The ruling party, however, has supported religious schools and tried to lift the ban on Islamic head scarves in public offices and schools. Secularists are also uncomfortable with the idea of Gul's wife, Hayrunisa, being in the presidential palace because she wears the traditional Muslim head scarf.
"We don't want a covered woman in Ataturk's presidential palace," said Ayse Bari, a 67-year-old housewife. "We want civilized, modern people there."
The military, one of the most respected institutions in Turkey, regards itself as the guardian of the secular system and has staged three coups since 1960.
"Neither Sharia, nor coup but fully democratic Turkey," read a banner carried by a demonstrator on Sunday.