By ANTHONY SHADID


ISTANBUL — Fifty years ago, when a populist prime minister tangled with the Turkish military, he ended up on the gallows, the mandate of three election victories little consolation. This time around, the rivalry climaxed with most of Turkey’s military command resigning simultaneously, its leader complaining of powerlessness and bad press. 
As Turks grappled Saturday with the shock of the resignations — and an extraordinary moment in modern Turkey’s history — officials scrambled to project a facade of business as usual, even as their critics warned of a creeping authoritarianism engineered by Prime Minister Recep Tayyip Erdogan, who has governed since 2003.
But in broader ways, the resignations on Friday delivered Mr. Erdogan a perch to reshape a military bound by civilian control, pursue a foreign policy emboldened by the decisive victory of his conservative and populist party in elections in June and pursue constitutional changes that could transform politics here.
The struggle that has posed the most serious danger to Mr. Erdogan — a powerful military willing to act above the law — in many ways appears to have come to an end.
“The days of Turkey’s military calling the shots are over,” said Cengiz Candar, a prominent columnist. “There’s a new equation in the politics of the country, and anyone depending on the military to score points on a political issue has to forget about it.”
In a move that officials acknowledged took them by surprise, Turkey’s top commander, Gen. Isik Kosaner, together with the leaders of the navy, army and air force, asked to retire Friday to protest the arrests of dozens of generals as suspects in long-running conspiracy investigations that Mr. Erdogan’s critics contend are politically motivated.
“Four-star earthquake,” declared a headline in Sabah, a pro-government newspaper. But Mr. Erdogan quickly promoted Gen. Necdet Ozel, the commander of the military police, as the projected replacement for General Kosaner. And while the prime minister said nothing publicly, perhaps in an attempt to stay above the fray, other government officials played down the idea of a vacuum or a future confrontation, in what appeared an effort to assure the country’s population of 73 million that a coup was not in the offing.
“It shouldn’t look as if a crisis, a problem still continues,” President Abdullah Gul said Saturday. “Events of yesterday were extraordinary in their scope; however, everything is back on track.”
The most immediate cause of the dispute between the military and civilian leaders was the arrests of military commanders in a series of investigations, given intensive coverage in the press, in which they and others were charged with conspiring to topple Mr. Erdogan’s government. More than 40 serving generals, almost a tenth of the country’s commanders, are under arrest on charges their supporters call flimsy.
But the battle runs far deeper, pitting a party with religious roots against an institution that has considered itself the guarantor of secular traditions, which underpinned the founding of the modern state in 1923 amid the wreckage of the Ottoman Empire. Suspicions ran deep enough that when asked to explain a murky sequence of events this year, Mr. Erdogan’s officials tapped their shoulders, signifying a general’s epaulets. The gesture was meant to cast blame on a military that his officials deem unduly unaccountable.
Officials said Saturday that there was growing frustration on their part over the military’s fight against a Kurdish-led insurgency in the southeast, which has claimed as many as 40,000 lives and seems to have escalated in past months. On July 14, 13 Turkish soldiers were killed in a clash with guerrillas in Diyarbakir Province, and the issue of rights for the Kurdish minority has proven almost as nettlesome as Mr. Erdogan’s contest with the military.
“The military is not really doing enough from a purely military point of view to prevent these attacks and these losses,” one senior official said, speaking on the condition of anonymity because of the delicacy of the issue. “Something is missing in the planning in our fight against terrorism.”
In some quarters, there was a sense of triumphalism over the resignations, serving as a sign of a military whose influence pales before the past, when it carried out three coups, beginning in 1960, and just 14 years ago drove from power a government that shared some ties with Mr. Erdogan’s Justice and Development Party, known as the A.K.P.
“In the old times when the military and politicians could not get along, politicians used to be given notice and they would be forced to quit,” Mehmet Barlas, a columnist, wrote in Sabah. “Now, the reverse is happening. It is not easy to get used to change.”
But the country’s intelligentsia seemed divided, perspectives shaped by venerable cleavages between liberal and conservative, religious and secular and nationalist and Islamist. Those divisions were highlighted in the resignations themselves. To Mr. Erdogan’s supporters, the generals’ departure underlined growing civilian control over the military, in a healthy sign of a democratic order. But the prime minister’s detractors say he managed his victory by deploying the justice system against the military, in another example of his party’s mounting hold on state institutions. 
“Those who believe the A.K.P. is a party with a democratic agenda are now applauding it and believe we are moving abruptly toward democracy,” said Ersin Kalaycioglu, a professor of political science at Sabanci University. “Others believe the A.K.P. is another conservative party with a conservative agenda trying to consolidate power in a new form of authoritarianism or even the dictatorship of one man.”
“There’s a split in opinion, completely,” he added.
Mr. Erdogan, a 57-year-old former mayor of Istanbul, has emerged as perhaps the most compelling political phenomenon here in generations. His party won 50 percent of the vote in June, its third victory since 2002. Mr. Erdogan has spoken of plans to overhaul the Constitution, drafted under military tutelage after a coup in 1980. Among his ideas were articles that would curb the power of certain judicial bodies and introduce a system that enshrines more power in the president than the prime minister. His clear majority in Parliament will help him carry out his agenda, though his party lacks the two-thirds majority to do it with relative ease.
In a prerecorded speech that was aired Saturday, Mr. Erdogan vowed to press ahead with the constitutional changes, describing the task as “our biggest duty.”
Buoyed by a thriving economy, Mr. Erdogan has been working for years to transform the country, building it into a decisive power in a region long dominated by the United States.
But since the election, he has become more forceful in foreign policy, combative and, some say, aggressive in his statements directed at neighboring Armenia, with which it has long been at odds. Relations with Israel, which once enjoyed warm ties with Turkey, have yet to markedly improve; they deteriorated badly in 2010 when Israeli troops boarded a Turkish boat that was trying to break the blockade of Gaza, and killed nine activists. This month, he took a harder line on the divided island of Cyprus, ruling out more concessions in negotiations to reunite the island’s Greek and Turkish regions.
“You have a completely different change of atmosphere in just two months,” said Hugh Pope, an analyst with the International Crisis Group in Istanbul. “It’s extraordinary. One assumes that the prime minister feels very strong and very powerful.”
General Ozel may offer Mr. Erdogan his most immediate impact. Though not considered an ally of the prime minister, he may have an attribute more valuable for a civilian leadership long dogged by the ambitions and sensitivities of generals. General Ozel appears to have neither, according to one newspaper profile of him a year ago.
“Up until today, he has never had a political stance at any time or on any basis,” wrote Namik Cinar, a columnist in the newspaper Taraf, which is critical of the Turkish military. “He will not become a middleman of a certain interest or political group.”