Turkish authorities have launched an unprecedented shake-up of the country's security forces after a section of the army attempted to overthrow the government on July 15, turning their weapons on the very people they were sworn to protect.

Soldiers involved in the coup killed hundreds of civilians who had taken to the streets to protect Turkey's elected government, shattering the country's deep-seated trust and admiration for the armed forces in a matter of hours.

"Because we fear others, we create an institution of violence to protect us, but then we fear the very institution we have created for protection," said Metin Gurcan, a security analyst who served as an adviser to the Turkish Armed Forces in Afghanistan, Kazakhstan, Kyrgyzstan and Iraq between 2002 and 2008.

"This implies the need to have protection both 'by' and 'from' the military," he told Al Jazeera.

OPINION: Coups work only for autocracies, not democracies

To solve this dilemma, the Turkish government has initiated a revolutionary civilianisation process, aimed at bringing the military under civilian control and ending the autonomy previously enjoyed by the Turkish Armed Forces. The changes, which began to be rolled out on July 27 under the terms of a state-of-emergency decree, would decrease the army's scope of influence in politics and society.

With the initial dismissal of more than 1,000 ranking officers, the state had formally discharged nearly 44 percent of land force generals, 42 percent of air force generals and 58 percent of navy admirals. By July 31, the total number of soldiers dismissed had surpassed 3,000, while the number of soldiers of various ranks detained stood at around 8,000.

Then, the Gendarmerie Command and Coast Guard Command were brought under the control of the Interior Ministry, while the land force, navy and air forces were brought under the control of the Defence Ministry.

Later, in another state-of-emergency decree, all of Turkey's military schools were shut down, and an inclusive new national defence university was founded to take their place.

The Turkish public, especially supporters of the government and President Recep Tayyip Erdogan, has largely applauded the purge in the military. But these rapid and fundamental changes to the structure, purpose and scope of the Turkish Armed Forces - an institution that for decades has been viewed as the foremost protector of Turkish democracy - also rang alarm bells for some.

"These reforms will certainly help to bring an end to military tutelage in Turkey," said Tarik Celenk, a retired major and the founder of Ekopolitik, a conservative think-tank.

"But we also need to be careful about the risks of civilian tutelage," he told Al Jazeera.

OPINION: Could Turkey turn its back to the West?

The Turkish military, which staged three coups between 1960 and 1980 and pressured former Prime Minister Necmettin Erbakan out of power in 1997, has played a very active role in Turkish political life for decades. In the early 2000s, the army slowly began to civilianise under pressure from both the AK party and the European Union, although it still remained mostly autonomous.

"The AK party brought stability to the political system, which in turn gave civilians power and prominence over the military," said Gurcan, who wrote his PhD dissertation on changes to the Turkish military over the past decade.

The AK party brought stability to the political system, which in turn gave civilians power and prominence over the military. Metin Gurcan, security analyst

"At the same time, Turkey diminished or ended military representation in civilian government bodies, introduced greater transparency in defence spending and policy-making, and improved parliamentary oversight of the military while on its reform pathway towards EU membership."

This process of civilianisation reached its peak with the Ergenekon and Sledgehammer trials, in which scores of officers from the Turkish Armed Forces were put on trial and jailed for attempting to topple the government.

In the beginning, these cases were seen as the most serious attempt yet to liberate Turkey from an overly controlling, meddling and dangerous military elite. But later, as both cases collapsed - with the revelation that most of the evidence against the defendants had been fabricated - they came to be seen as little more than a witch-hunt against the secular enemies of Fethullah Gulen, a former Erdogan ally, who has been blamed for last month's coup attempt.

READ MORE: Turkey court overturns Ergenekon 'coup plot' convictions

Now, even the Turkish government, which gave its full support to prosecutors at the time, accepts that the Ergenekon-Sledgehammer trials were used by Gulenist elements within the judiciary to cull secular personnel from the armed forces.

Amid this backdrop, some secular Turks who view the military as the ultimate protector of Turkey's "secular identity" have expressed concerns about the current civilianisation process of the armed forces. They fear it could pave the way for another cull of secular military staff, in a similar vein to Ergenekon and Sledgehammer.

At the moment, there are two prominent factions in Turkish society: people who value secularism and principles of Kemalism the most, and people who value religion. Tarik Celenk, Ekopolitik

"At the moment, there are two prominent factions in Turkish society: people who value secularism and principles of Kemalism the most, and people who value religion," Celenk said.

"A considerable amount of tension exists between these two groups. They have been suspicious of each other since the first AK party government took power in 2002. They may have come together to fight against Gulen, but they did not actually solve their issues. They only postponed facing them."

After last month's failed coup attempt, several military personnel dismissed as a result of the Ergenekon and Sledgehammer trials were reinstated in their military roles - but this was not enough to convince secular Turks that stripping the army of its autonomy is the best course of action.

"The attempted coup has not only created a fault line between the military and society, it also increased the visible split between the pro-AKP masses and Turkey's secularist circles," Gurcan said, noting that two competing narratives over the question of "who prevented the coup" have emerged, pitting the secular elite and civilian masses against each other.

"The first narrative focuses on the idea that the people prevented the coup, while the army was sitting in the shadows," he said. "This narrative has been taken up predominantly by the mobilised pro-AK-Party and Islamist masses. Their objective is to bring the military under fully-fledged civilian control."

INSIDE STORY: Is Turkey undergoing a shift in foreign policy?

The second narrative is that "the military itself resisted the coup plotters, and those Kemalists and secularists within the military prevented the coup", he added. This camp is mainly led by ex-officers who were arrested and tried in the Ergenekon-Sledgehammer cases, Gurcan said, as well as some drawn from secularist and nationalist circles.

"They argue that the military should reset to its default factory settings, which are Kemalism, secularism, and the other founding principles of the Republic. Their objective is to re-establish military autonomy with a new ideological outlook," he said.

"Because of this, Turkish civilian-military relations have become a new domain for political conflict on the nature and extent of secularism, Kemalism, and religion, which is not good."

Celenk noted that rapidly reforming the military following the coup attempt may "deepen divisions" within society.

"The [failure of the] coup attempt was a chance for reconciliation," he said. "But if the government does not seek to reach a consensus with the secularists regarding the future of the Turkish Armed Forces, we may witness further polarisation."

The government has a responsibility to prevent the two sides from becoming embroiled in an open conflict over such an important institution as the military, he said.

OPINION: What's behind the Turkey-Russia reset?

The implications of this process will affect much more than just Turkish domestic politics, particularly as Turkey continues its fight against the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) and the Kurdistan Workers' Party (PKK).

For its part, the government insists that the purge and subsequent reforms to the army will only increase Turkey's military prowess.

“Removing rogue elements from the security forces will make it easier for Turkey to address national security threats, including ISIL and the PKK," a senior government official told Al Jazeera.

"We will be able to make sure that each part of the system receives orders from their official superiors instead of their superiors within FETO [Fethullah Gulen Terror Organisation]," he added.