ANKARA, Turkey, Saturday, April 28 — A revolt by Turkey's secular opposition on Friday derailed the first round of voting on a presidential candidate with a background in political Islam, and in a harsh warning, the military hinted that it might act against the government if it strayed too far from secularism.
The growing tension over the candidate, Abdullah Gul, a close ally of Prime Minister Recep Tayyip Erdogan, has brought Turkey to a defining moment. Since Mr. Gul's emergence as the sole candidate for president, a powerful post chosen by parliamentary vote, the country's opposition and military have warned that his selection would bring an end to the era of secular modernism that began with the Ataturk revolution in 1923.
The action on Friday began on the floor of Turkey's Parliament, where all of the country's secular political parties boycotted a vote for Mr. Gul, a member of Mr. Erdogan's political movement, which has its roots in Islam. Even with the absence of the opposition, Mr. Gul received 357 votes, 10 votes short of the two-thirds mark he needed to be confirmed.
After the boycott and during the voting, the main secular party applied to the constitutional court to have the vote annulled, arguing there were too few lawmakers present. If the party prevails and the court intervenes, it could trigger early nationwide elections.
But more troubling was a statement released by the military shortly before midnight. In it, the general staff invoked its responsibility as the defender of Ataturk's legacy of secularism — a thinly veiled threat, given that the armed forces have ousted four elected governments in the past 50 years.
"In recent days, the problem during the presidential election has focused on secularism discussions," the statement read. "This situation has been anxiously followed by the Turkish Armed Forces. The Turkish armed forces maintains its firm determination to carry out its clearly specified duties to protect these principles and has absolute loyalty and belief in this determination."
The one-and-a-half-page statement went on to list what it called recent violations against secularism: a Koran class held on National Day, school principals ordered to celebrate the Prophet Muhammad's birthday and preaching organized in a public school.
"The fact that a large portion of such activities was conducted with the consent and approval of local government offices intensifies the gravity of the issue," the statement said.
It was not clear on Friday night whether the military was prepared to oust Mr. Erdogan's government if he continued to push Mr. Gul's candidacy, but the warning was the sharpest it has made in recent years, and raised questions about whether Mr. Erdogan had stretched the limits of the secular state too far.
The military issued a similar warning to the government of the Islamist politician Necmettin Erbakan shortly before he was forced from power in 1997; he remains under house arrest.
"They will create for the first time in Turkey a very dangerous situation and upset all the balances," said Onur Oymen, a leader in the main secular opposition party, of the prospect of Mr. Erdogan's party controlling the presidency, prime minister's office and Parliament. "In a country with a Muslim population, you can't have democracy without secularism."
But in the paradox of modern Turkey, it has been political leaders like Mr. Gul and Mr. Erdogan, both important thinkers in Turkey's political Islam movements of the 1990s, who have proved most adept at modernizing the state.
Mr. Gul, the country's foreign minister, has lobbied tirelessly for Turkey's membership in the European Union. In the party's four years in power, the Turkish economy has experienced unprecedented growth.
"This government has been in power for four years and they have done nothing to put Islam in politics," said Metin Heper, a political science professor at Bilkent University in Ankara.
European and American diplomats, initially skeptical of the party, now have signaled no objection to Mr. Erdogan and his allies.
Mr. Gul's chances of being confirmed as president appear strong if the constitutional court does not intervene or if Mr. Erdogan does not withdraw him from consideration because of the military's threats. Mr. Gul faces another round of voting next week. If a third round is required, a simple majority endorsement by Parliament would be all he needs — nearly assured, given that his party controls 353 of 554 seats.
Before the vote on Friday morning in the elegant stone Parliament building here, Mr. Gul's party was trying hard to win over the opposition. Small pots of rice pudding, Ataturk Forest Farm ice cream and more than 100 pounds of Turkish delight were handed out. The treats circulated, but the two camps remained separate: nearly half of the inner chamber's seats were empty, their secular occupants in a back room smoking, sipping tea and watching the proceedings on a flat-screen television.
Turkish society has changed dramatically in the 80 years since the state was founded, and in many ways the secular party leaders do not seem to have changed with it.
Ali Bulac, a columnist for a conservative daily newspaper, Zaman, said that the secular elite "are losing their status, their advantages. So naturally they will react."
While much of Turkey's secular elite exaggerates the threat of Islamism to suit their political needs, some secular Turks have strong arguments for fearing a future in which the devout rank-and-file of Mr. Erdogan's party enter midlevel government jobs.
Guldal Okutucu, the head of the women's branch of the main opposition party, said she had documented instances of local officials separating men from women in hotels and hospitals and at beaches.
"In every place that has life," she said, smoking a cigarette in the opposition's back room, "we're trying to take action because tomorrow it might be too late."
Sebnem Arsu contributed reporting. -- Yoshie