* Intelligence chief bugged in meeting on Syria
* Erdogan says recording is "villainous"
* YouTube blocked over threat to national security (Adds U.S. State Department comment)
By Nick Tattersall
ISTANBUL, March 27 (Reuters) - Turkish Prime Minister Tayyip Erdogan on Thursday denounced as "villainous" the leaking of a recording of top security officials discussing possible military action in Syria to the video-sharing site YouTube.
Turkish authorities ordered the shutdown of the site.
Erdogan's foreign minister Ahmet Davutoglu called the posting a "declaration of war," an apparent reference to an escalating power struggle between Erdogan and rivals.
The anonymous posting was an audio file with photographs of the officials involved.
It followed similar releases on social media in recent weeks that Erdogan has cast as a plot by his political enemies, particularly a Turkish Islamic cleric based in the United States, to unseat him ahead of March 30 elections.
The posting took the campaign to a higher level, impinging on a highly sensitive top-level meeting of security officials.
"They even leaked a national security meeting," Erdogan said at a campaign rally. "This is villainous, this is dishonesty ... Who are you serving by doing audio surveillance of such an important meeting?"
Reuters could not verify the authenticity of the recording.
The account posted what it presented as a recording of intelligence chief Hakan Fidan discussing possible military operations in Syria with Davutoglu, Deputy Chief of military Staff Yasar Guler and other senior officials.
Speaking to reporters in Kutahya, Davutoglu confirmed the meeting took place and said, "A cyber attack has been carried out against the Turkish Republic, our state and our valued nation. This is a clear declaration of war against the Turkish state and our nation."
Turkish authorities said they had taken an "administrative measure" to impose a block on YouTube, a week after they blocked access to microblogging site Twitter.
Erdogan has been the target of a stream of anonymous internet postings suggesting his involvement in corruption. He denies the allegations and accuses a former ally, Islamic cleric Fethullah Gulen, of unleashing a campaign to undermine him before Sunday's elections.
Gulen, who has a large network of followers in the police, denies any involvement in the postings and in police graft investigations impinging on Erdogan and his family. Erdogan denies graft allegations.
The foreign ministry said the recording was of a crisis management meeting to discuss threats stemming from clashes in Syria and that elements of the recording had been manipulated. The leakers would face heavy punishment, it said.
"It is a wretched attack, an act of espionage and a very heavy crime to record and leak to the public a top secret meeting held in a place where the most delicate security issues of the state are discussed," it said in a statement.
The conversation appeared to centre on a possible operation to secure the tomb of Suleyman Shah, grandfather of the founder of the Ottoman Empire, in an area of northern Syria largely controlled by militant Islamists.
Ankara regards the tomb as sovereign Turkish territory under a treaty signed with France in 1921, when Syria was under French rule. About two dozen Turkish special forces soldiers permanently guard it.
"NATIONAL SECURITY ISSUE"
Turkey threatened two weeks ago to retaliate for any attack on the tomb following clashes between militants of the Islamic State of Iraq and the Levant (ISIL), an al Qaeda breakaway group, and rival rebel groups in the area, east of Aleppo near the Turkish border.
"An operation against ISIL has international legitimacy. We will define it as al Qaeda. There are no issues on the al Qaeda framework. When it comes to the Suleyman Shah tomb, it's about the protection of national soil," a voice presented as that of foreign ministry undersecretary Feridun Sinirlioglu says.
When the discussion turns to the need to justify such an operation, the voice purportedly of Fidan says: "Now look, my commander, if there is to be justification, the justification is, I send four men to the other side. I get them to fire eight missiles into empty land. That's not a problem. Justification can be created."
The foreign ministry said it was natural for state officials to discuss defending Turkish territory.
"In the meeting it was confirmed that Turkey would take necessary steps decisively to protect the security of our personnel at the Suleyman Shah tomb and Turkey's will to defend it in the face of an attack was reiterated," the statement said.
A source in Erdogan's office said the video sharing service was blocked as a precaution after the voice recordings created a "national security issue" and said it may lift the ban if YouTube agreed to remove the content.
Reacting to the YouTube ban in Turkey, U.S. State Department spokeswoman Marie Harf in Washington said the United States opposes "any action that encroaches on the right of free speech or free expression."
Harf said U.S. officials "continue to urge the Turkish government to unblock its citizens' access now to YouTube, but also still to Twitter."
Google said it was looking into reports that some users in Turkey were unable to access its video-sharing site YouTube, and said there was no technical problem on its side.
The ban on Twitter had already sparked outrage in Turkey and drawn international condemnation. Shortly after the YouTube move, the hashtag #YoutubeBlockedinTurkey was trending globally, although some users defended the latest government decision given the sensitive nature of the recordings. (Reporting by Daren Butler, Ece Toksabay, Can Sezer and Evren Ballim in Istanbul, Tulay Karadeniz, Orhan Coskun, Humeyra Pamuk and Jonny Hogg in Ankara, and Will Dunham in Washington; Writing by Nick Tattersall; Editing by Ralph Boulton, Andrew Roche, Toni Reinhold)