Kemal Ataturk, the secular reformer, has become the symbol for young Turks defying what they see as Recep Tayyip Erdogan's reactionary reversion to the Ottoman past

Among the tents, snoozing youth and pleasant shady trees of Istanbul's Gezi Park there are portraits of one man in a European suit. Wherever you look Mustafa Kemal Ataturk – founder of the Turkish Republic – gazes sternly at you. Photos of the first president hang from branches, have been affixed to tea stalls, and even encircle a giant banner showing Turkey's prime minister, Recep Tayyip Erdogan, dressed as Hitler.

"We really love Ataturk. He changed our state. He made it into a modern republic," explained Murat Bakirdoven, a 24-year-old biology student who has been camping in the park for a week. Someone had stuck another photo of Ataturk – this time in a lounge suit, sitting on a leather chair, cigarette in hand – on a nearby tree. Bakirdoven added: "Erdogan wants us to forget him. Instead we are trying to create an Ataturk renaissance."

For the protesters who have taken part in Turkey's anti-government demonstrations, Ataturk is a hero. Dead for 75 years, he has become the reborn symbol of this student-driven anti-Erdogan movement. (The other motif is a penguin – a reference to the state media, which failed to report on the uprising for several days; one channel, CNN Turk, instead screened a nature documentary on Antarctica).

The symbolism goes to the heart of what this unprecedented uprising is about: Turkey's modern identity. At issue is whether Turkey should be the progressive, secular European nation-state that Ataturk originally envisaged and shaped from the ruins of the Ottoman empire, or a more explicitly religious country, a sort of Muslim version of Christian democracy. The protesters want the former; Erdogan, and his ruling Islamist-rooted Justice and Development party (AKP), it appears, the latter.

What has infuriated protesters is what they perceive as Erdogan's clunking attempts to impose his Islamic values on everyone else. Last month Turkey's government passed a new law banning the sale of alcohol between 10pm and 6am, and banishing it from the vicinity of schools and mosques. Two years ago it forbade access from Turkey to pornographic websites and temporarily shut down YouTube. Erdogan has spoken out against gay rights. "All this built up a wall of pressure," Bakirdoven said. Many also sense a creeping campaign to undermine Ataturk himself. Traditionally girls and boys would celebrate Ataturk day, 19 May, by dancing and singing in stadiums around the country. In 2012 Erdogan ditched the ceremony, saying no one wanted to see girls prance around in skimpy skirts. Then last week Erdogan defended his anti-alcohol legislation by obliquely calling Ataturk and his closest ally, Ismet Inonu, a couple of "drunkards".

All of this has galvanised educated, middle-class Turks to defend their personal freedoms. It began as a small environmental protest against plans to redevelop Gezi Park, and Istanbul's adjoining Taksim Square. But over the past two weeks it has morphed into a countrywide revolt. Three people have been killed, 4,000 injured and 900 arrested. The demonstrations have spread to more than 70 Turkish cities, including the capital, Ankara, and the restive western city of Izmir.

Erdogan has responded to this crisis in typically abrasive fashion. He dismissed the protesters as "looters". He denounced Twitter as a "curse" and laid into the New York Times. On Friday he accused the European Union of hypocrisy after it condemned the crackdown by Turkish riot police, who turned water cannon and teargas on peaceful demonstrators. He has also sought to blame the unrest on murky foreign forces and homegrown terrorists.

In the meantime, Gezi Park has been transformed into Turkey's first ever hippy commune, home to a vibrant open-air democracy festival: volunteers plant flowers and collect rubbish; there is a bookshop; and free food for camp denizens. At night tens of thousands pack into the area to sing and dance – drumming until the early hours. The spirit of May 1968 hovers in the air. "Ataturk said that Turkey belonged to the youth. That's us," said Ayda Agaoglu, a 23-year-old architecture student.

Analysts say that Erdogan's neo-Islamist legislative project has backfired. "He [Erdogan] will never manage to control civil society. It's completely empowered now," said Cengiz Aktar, professor of political science at Istanbul's Bahcesehir University. "To some extent this is re-Islamisation. Erdogan is a devout Muslim. But more than that he is a social engineer. He has a very high opinion of his own values, which happen to be Islamic values."

According to Aktar, Erdogan decided to undermine the Ataturk reforms after winning a whopping majority in the 2011 parliamentary elections, his third election victory. "Political Islam always taught, and sometimes rightly so, that Muslims were a majority in this country, especially Sunni believers. Kemalist power de-legitimised them. That's the fundamental paradigm. They [Erdogan and his supporters] started to challenge that."

Critics believe that the plans for the square amount to a further assault on Ataturk and his historical legacy. On Friday, Erdogan said he wanted to demolish the Ataturk cultural centre – a modernist building on Taksim's north side, which he says is not "earthquake-proof" – and replace it with a baroque opera house.

Most controversially, Erdogan wants to raze Gezi Park and rebuild the Ottoman military barracks that used to be there. The barracks were the site of a 1909 attempt by the Ottoman sultan Abdul Hamid II to stop the liberal reforms that eventually led to Ataturk's modern republic. Erdogan has also named Istanbul's "third bridge", linking Europe and Asia, after an Ottoman despot who slaughtered tens of thousands of Alevis, Kurds and Turkmens back in the 16th century.

Critics say these decisions are part of a sinister policy, yearning for a kitsch version of the pre-Ataturk past. According to Murat Bakirdoven, there are few reasons to be nostalgic. "The Ottoman empire was religious, very strict, and ruled by Islamic law. Women didn't have rights and couldn't vote." Ataturk, by contrast, separated religion from government, and gave Turkish women the vote before their Swiss and German counterparts. "Ataturk wasn't a dictator. He believed in law. He was highly intelligent," he added.

It is unclear how long Istanbul's summer of love will last. In the meantime, the young protesters are enjoying their own utopian moment: flirting, debating, drinking cans of Efes beer, and learning from each other. At first groups of students chanted: "We are the soldiers of Ataturk"; this died out after feminist protesters objected to its militaristic overtones. Bakirdoven said: "People used to sing 'Erdogan is the son of a whore'. But when the police teargassed us, one of the brothels on Taksim Square opened its doors, and the women gave us shelter and treated us with lemons. They don't sing that any more."