Turkey's Prime Minister Tayyip Erdogan addresses members of his ruling AK Party (AKP) during a meeting in Ankara November 29, 2013. REUTERS/Umit Bektas ISTANBUL (Reuters) - Istanbul's powerful police chief was dismissed from his post on Thursday over an anti-corruption action striking at the heart of Turkey's ruling elite and threatening the authority of Prime Minister Tayyip Erdogan at home and abroad.

Huseyin Capkin was the most senior commander so far to be sacked following the dismissal of dozens of senior officers on Wednesday over what Erdogan has termed a "dirty operation" to tarnish the government.

Scores of people, including sons of three ministers and some prominent businessmen close to Erdogan, have been detained in an action seen widely as symptom of a power struggle with a U.S.-based cleric who wields influence in police and judiciary.

"Just as naturally as it was for us to come, so it is equally natural for us to go," Capkin told Turkish television. "We have tried to serve our state, our nation with loyalty."

He was moved to a lowprofile post in the Interior Ministry.

Erdogan's AKP was created in 2001 from a coalition of conservative religious, centrist and nationalist politicians. It swept to power in 2002, drawing on fury over corruption and economic incompetence. Turks have seen unprecented prosperity since then, but underlying perceptions of graft remain.

"Corruption in Turkey is the Achilles Heel of the AK Party," Writer and columnist Cengiz Candar said. "It also undermines their approach towards their morality, which is grounded on Islam.

"Corruption has an important impact in terms of determining the success of ruling parties at the ballot box."

Erdogan, still by far the most popular Turkish leader of modern times, said he would not tolerate corruption, but saw in the raids a conspiracy to "create a state within the state".

"We will definitely unveil this organization," he said.

Erdogan has reshaped Turkish foreign policy, with strong diplomatic forrays into Middle Eastern affairs and a more assertive relationship with the United States and NATO allies. He won great personal popularity as a model for an islamic democracy, though that has faded in such countries as Egypt.

Turkish influence across the Middle East and Africa has been driven, many say, by three motors: Turkish diplomacy, Turkish commerce, notably in construction, and the work of U.S.-based cleric Fethullah Gulen, who has set up a network of private schools stretching also to Europe, Asia and America.

DOUBLE STANDARDS

Domestically, Hizmet backed Erdogan's moves to banish the army from politics, ending decades of military interventions to overthrow elected governments, including an Islamist-led administration in 1997. Hundreds of senior Turkish officers, strongly secularist and wary of Erdogan's islamist background, have gone to prison on charges of preparing a coup.

Professor Mehmet Altan at Istanbul University suggests Erdogan may be trying to fend off a broader corruption scandal to avoid being tarred with the same brush as his predecessors.

"They (the government) supported the steps against the military. Now that tutelage is gone but a different one is in power. You can't govern with these double-standards.

"Their image outside has been seriously tarnished as well...Unless there is a change, they risk further damage."

Gulen's Hizmet (Service) movement, long a close ally of Erdogan, has in recent months publicly fallen out with the Prime Minister over the prime minister's plans to shut down private schools in Turkey, including those run by Hizmet.

There have been differences also on what critics see as Erdogan's meddling in Turks' private lives and his uncompromising attitude over a violent police crackdown on protests last summer. Erdogan wrote the demonstrators off as "riff-raff" and cited a foreign conspiracy against Turkey; something he has also already alluded to in the graft inquiry.

The schools and other social organizations have won Hizmet wide if largely unseen influence in the police, security services, judiciary and within the AKP Party itself - the chief reason why actions by the police and prosecutor have been widely seen in Turkey as a manifestation of this tension.

Pro-government newspapers have accused Gulen's followers of running a smear campaign against AKP. A lawyer for Gulen said his client had no information about the investigation or knowledge of the officials running it.

The corruption investigation has weighed on sentiment in Turkey's financial markets as well, fuelling questions over political stability.

The AKP was formed by Erdogan who has been the strongest uniting force, holding together a broad coalition of political views. Any erosion of his authority, already tested by last summer's riots, could be hazardous.

"After this week the investors are questioning whether the party will stay united," Charles Robertson, chief economist at Renaissance Capital.

(Additional reporting by Gulsen Solaker, Orhan Coskun and Ece Toksabay in Istanbul, Editing by Ralph Boulton)