(Adds comment from President Gul)
* Elements in police, judiciary harming stability, minister says
* Another ruling party deputy resigns
* Some $50 billion wiped off value of Turkish listed companies
By Daren Butler
ISTANBUL, Dec 31 (Reuters) - Turkey's government said on Tuesday it was fending off a "mini coup attempt" by elements in the police and judiciary who served the interests of foreign and domestic forces bent on humbling the country.
Deputy Prime Minister Ali Babacan said the ruling AK Party had in the past survived military coup plots and attempts in the courts to outlaw it. It would not now yield to a corruption investigation that he said targeted the government but was already damaging the national economy.
"These latest formations in the judiciary and the police, we can't call it a coup, but a mini coup attempt. This is what interests foreign investors," he told broadcaster CNBC-e, echoing suggestions by Prime Minister Tayyip Erdogan of a foreign interest in the crisis.
"Maybe the clearest indicator of this was the fall in share prices," added Babacan, who is in charge of the economy.
The market value of Turkish listed companies had fallen $49 billion by Monday's market close, he said. The main share index was down 1 percent on Tuesday.
Erdogan has, without naming it, accused a movement led by Turkish cleric Fethullah Gulen of creating a "state within a state", using influence in the police and judiciary in a campaign to discredit the government.
The "Hizmet" (Service) movement controls a vast global network of schools and businesses. Tensions have grown between the two former allies over elements of foreign and domestic policy and moves to close his private schools in Turkey.
The graft inquiry became public on Dec. 17 with a series of raids and detentions of senior businessmen close to Erdogan and of the sons of three ministers. Since then, the media hostile to Erdogan has brimmed with tales of police raiding offices or homes and seizing caches of dollar bills.
President Abdullah Gul, seen as unifying figure who has largely stayed out of the furore, made an appeal for unity in a New Year's message, stressing the importance of a clear separation of powers.
"It is the duty of all of us to avoid attitudes that damage the fact and perception of an independent and impartial judiciary," he said in the message on the presidency website.
Erdogan's supporters argue the graft accusations have so far lacked any substance and were driven by political ambitions.
"We as the government are on the job," Babacan said. "We created this political and economic stability with our own strength. We will not easily allow someone to come and take it away. However many efforts there were until now trying to shake political stability, we overcame them all."
Erdogan has overseen strong economic growth and a period of political stability unmatched in modern times since his AK Party was first elected in 2002.
The current corruption crisis is not the first critical moment for Erdogan, who created the party with the name AK - a word that in Turkish suggests purity and resistance to the corruption that had tainted older established parties.
Hundreds of senior army officers have been jailed on accusations of plotting to overthrow Erdogan, who has succeeded in banishing from politics a military that had intervened to topple four governments in the second half of the 20th century.
Hardliners in the judiciary tried in 2008 to impose a ban on the AK Party, a coalition of conservative religious elements, centre-right figures and nationalists that was accused of endangering the country's secular order.
As Babacan was speaking, news emerged of a further resignation from the AK Party. A total of seven MPs have resigned from the AKP since the end of November, five since the Dec. 17 police raids.
There is, however, no sign of any large-scale abandonment of the party which dominates Turkish politics. Erdogan, playing on his still unrivalled popularity, could even call early elections next year to shore up his position.
Erdogan has responded to the corruption scandal with the purging of some 70 police investigators and blocked a second wave of investigations. Those targeted some of Erdogan's most ambitious infrastructure projects, including a third Bosphorus bridge and a canal allowing passage from the Black Sea to the Mediterranean, easing traffic on the Istanbul Strait.
Erdogan, whose popularity held up through a summer of protests against what critics call an increasingly authoritarian style of government, has broadened Turkish influence in the Middle East and Africa with a vigorous business drive, led often by construction projects.
Certainly, this has been to some extent to the detriment of relations with the United States and European Union.
"There is a very significant and broad mass uncomfortable with the position which Turkey has reached in the last 11 years, the advances it has secured, the power it has created in the region, its resonance in the world," Babacan said. (Additional reporting by Gulsen Solaker in Ankara; Writing by Daren Butler; editing by Ralph Boulton)