President Recep Tayyip Erdogan, who has had a string of electoral victories since his party came to power in 2002, appears to have emerged stronger than ever after supporters rallied behind his government and helped rebuff an attempted coup last week.

Analysts predict Erdogan, who has dominated politics first as prime minister and then as president, may capitalize on developments to change the constitution and formalize a more robust role for the president.

In the wake of the coup, authorities have wasted no time in purging institutions, with thousands dismissed or arrested across the military, judiciary and interior ministry. Here's a look at some key issues as the country tries to move forward:

___

SECURITY/MILITARY

The coup attempt comes as Turkey, which has NATO's second-largest military by personnel, is engaged in a two-prong war — against Islamic State militants in neighboring Syria and against Kurdish rebels at home. The reputation of the armed forces, which historically played the role of defender of secular values and has staged three successful coups, has taken a beating. Scenes of soldiers surrendering to civilians and policemen rounding up army commanders dominated media coverage in the wake of the botched coup, which involved some members of the military but not most top brass.

Nearly 3,000 military personnel have been detained since Friday, raising questions about whether the failed coup was carried out by as small a faction of Turkey's 500,000-strong military as authorities have claimed. The number of detained includes a total of 103 generals and admirals who have been detained for questioning, 41 one of them arrested pending trial. Authorities say Akin Ozturk, the former Air Forces commander, was the ringleader of the attempted coup, though he has denied involvement.

Soner Cagaptay, director of the Turkish research program at The Washington Institute, warns the army's loss of prestige and personnel will hurt the country's ability to fight militants linked to the Kurdistan Workers' Party, or PKK, and be effective in the U.S.-led coalition against the Islamic State group, where it is a key partner.

___

JUDICIARY

The government has sacked roughly a fifth — 2,745 members — of the judiciary and detained 755 judges and prosecutors over suspected links to a movement led by a U.S.-based Muslim cleric. The government says the cleric, Fethullah Gulen, is behind the failed uprising, an accusation he has denied.

It is unclear whether the judiciary will have enough manpower for such a vast number of coup-linked legal proceedings in addition to regular cases. Government supporters are calling for traitors to be punished with the death penalty, which Turkey abolished in 2004 as part of its bid to join the European Union. The remarks of Turkey's highest ranking officials, the president and prime minister, suggest the idea is being entertained. Germany says that would spell the end of negotiations for Turkey to join the EU.

___

ECONOMY

Turkey could be headed for a period of slowed economic growth, a struggle to attract international investors and financial market volatility. On Monday, the Borsa Istanbul 100 index closed down 7.1 percent, at 76,957.61. The Turkish lira was down 1.5 percent against the dollar at 2.9710.

Paul Gamble, a senior director at ratings agency Fitch, said the attempted coup and the authorities' reaction highlight "political risks" to Turkey's BBB- rating. Fitch's next review of Turkey's sovereign rating is due on Aug. 19.

Turkish Prime Minister Binali Yildirim insisted Monday that the failed coup would have no major economic impact.

"Our banks, our bourses are working," he said. "Our central bank is on top of its duties. Any changes in economic indices are normal and no different from fluctuations recorded on normal days."

But International investors, key to financing Turkey's 4.5 percent current account deficit, could well be spooked by images of tanks rolling in the cities of Turkey and rogue fighter jets bombing government facilities.

The same applies to tourists. Turkey had already witnessed a sharp decline in visitors as a result of a string of bombing attacks carried out by Islamic State and Kurdish militants.

___

FREEDOMS

Turkey has witnessed a sharp decline in freedoms of expression and association in recent years, with opposition media outlets being taken over by the government and allegedly Gulenist-linked publications being shuttered. On Monday, the board of the Turkish Journalist Associations condemned raids on media establishments, restrictions to access and mob violence against journalists in the wake of the coup.

Turkish government officials have hailed the defeat of the coup as a victory for democracy at a time when human rights activists and international observers warn the country is fast slipping toward authoritarianism, pointing to the high number of arrests of academics, intellectual, journalists and legislators.

"It is important to understand that whilst the Erdogan government is democratically elected it is certainly not liberal," says Dr. Natalie Martin, an expert on Turkish politics at Nottingham Trent University in England. "It does not have a free news media, the rule of law is patchy and there is no freedom of protest or association unless you are an AKP protester." The AKP, or Justice and Development Party, is Erdogan's party.

In the months before the coup, even small protests by groups including Kurdish demonstrators and more recently the LGBT community have been countered by massive security deployments, water cannons and tear gas. With the government's popularity boosted, government critics fear that the space for dissent will narrow further.