Mr. Erdogan’s government has condemned the inquiry as a politically motivated plot against it by a “criminal gang” within the state, and Mr. Erdogan himself has warned that those seeking to ensnare him will fail.

Government allies have attributed the investigation, fairly or not, to Fethullah Gulen, a reclusive and powerful Muslim preacher who lives in Pennsylvania. Mr. Gulen has millions of followers, including powerful sympathizers within Turkey’s police and judiciary. Once an ally of Mr. Erdogan’s, Mr. Gulen appears to have had a recent falling-out with the prime minister that analysts say is reverberating in Turkish politics.

Observers have suggested that the inquiry was undertaken in retaliation for a government decision to close university preparatory schools, where the Gulen movement has recruited many of its followers. Mr. Gulen’s sympathizers have begun a huge campaign on social networks like Twitter to protest the closing of the schools.

Mr. Gulen’s followers deny accusations that his adherents control state institutions. They say that his sympathizers have risen in the ranks of the police and the judiciary on the strength of their qualifications and talents.

Mr. Gulen, in a letter addressed to President Abdullah Gul and published over the weekend, suggested cooperating to end the conflict and insisted that he had no control over public servants.

But the battle shows little sign of abating.

Mr. Erdogan said over the weekend that the government was preparing a legal framework to allow the retrial of dozens of military officers who were recently convicted of plotting to overthrow the government. The trials are believed to have been spearheaded by sympathizers of Mr. Gulen, with the tacit approval of the government.

The power of the military, the traditional upholder of Turkey’s secular state, has been tamed under Mr. Erdogan, a religious conservative, with the help of Gulen sympathizers in the police and the judiciary. The clampdown on the military, which has staged coups against three previous governments, has been praised by many in Turkey for helping to cement civilian rule over a once untouchable force.