Turkey's military and government were actually getting along -- before the coup

The attempted military coup Friday night in Istanbul comes as a shock, perhaps most of all to Turks themselves. 

It's the latest worrying example of deteriorating stability in a country that a few years ago was being promoted to the wider Muslim world as a model of democratic governance and economic prosperity. 

Some 14 years after the political party of Turkish President Recep Tayyip Erdogan swept to power in elections, Turkey once again teeters on the brink. 

Turkey has a long history of military coups

 

Turkey has a long history of military coups 

LIVE BLOG: Follow latest updates

Battles on two fronts

Today, the Turkish government is simultaneously battling two deadly terrorist organizations -- ISIS and the separatist Kurdistan Workers Party (PKK). 

Just last month, the government accused ISIS of carrying out the deadly triple suicide bombing at Istanbul's Ataturk International Airport. 

Meanwhile, the 30-year guerrilla war between the Turkish state and Kurdish militants reignited, flaring across the predominantly Kurdish southeast of the country. 

Society is widely polarized between people who love or loathe Erdogan. Security services routinely use force to crush attempts at public protests against the government. Human rights groups constantly criticize the government for the arrest of critical journalists. 

The violence has taken its toll on the tourism industry and the value of the country's currency. 

What is a coup d'état?

 

What is a coup d'état?

Turkey's currency plunges amid military coup attempt

Military role

However, amid the many challenges roiling the country, the military had not been seen as a threat. 

Generals were accustomed to playing a dominant role in the Turkish state, after carrying out four military coups from 1950 to 2000. During the first years of his reign, Erdogan often clashed with top commanders. 

Several years into the Erdogan era, the government began arresting and prosecuting hundreds of generals and admirals as part of wide-ranging investigations into alleged coup plots.

Supporters argued Erdogan was the first Turkish leader to put the military in its place beneath the elected civilian leadership. 

By May 2016, the once frosty relationship between politicians and uniformed officers had transformed - the military's top commander even attended the wedding of Erdogan's daughter.

This weekend's deadly violence in Istanbul and Ankara involving tanks, fighter planes and attack helicopters point to deep discontent within some ranks in the military.

Watch CNN Turk's final moments on air before soldiers shut it down

During the tumultuous first hours of the attempted coup, Erdogan vowed to purge the military of traitorous elements.

"We will maintain our position until the end and all these tanks will go back to where they came from," he said during an appearance before journalists in the predawn hours Saturday.

He successfully mustered large crowds of supporters who took to the streets in cities across the country and in some cases confronted soldiers carrying out the coup.

In a sign of how little apparent public support the coup plotters have, even long-standing critics of the Erdogan government have publicly condemned the plot.

All three main opposition parties represented in Parliament -- which was reportedly bombed by aircraft -- came out to denounce the plot.

News Courtesy: www.cnn.com