ANKARA - Turkey’s embattled government vowed action on Friday over the bugging of a security meeting on Syria which was leaked on YouTube, labelling it a conspiratorial “plot” ahead of key local elections.

The leak comes amid a fierce standoff between Prime Minister Recep Tayyip Erdogan and his ally-turned-foe, US-based cleric Fethullah Gulen, whose followers Erdogan has blamed for the eaves-dropping. As prosecutors launched a probe into the case, President Abdullah Gul warned “we will do whatever necessary” to find the culprits behind the “act of espionage targeting state security”. “Such a cyber attack in a meeting in which military and security options are being discussed is no different than a military attack,” said Foreign Minister Ahmet Davutoglu, who is alleged to be one of the voices on the recording. “We will take action against those who want to throw Turkey into chaos with political plotting,” he added.

The recording purportedly features top government, military and intelligence officials discussing plans to fabricate an attack that would justify a military strike against neighbouring Syria.  The leak followed other recordings that implicated Erdogan and his political and business allies in a vast corruption scandal, and which have gone viral on social media in recent weeks.

The government, which last week shut down Twitter, ordered a block on YouTube on Thursday in response to the latest release, prompting fresh criticism from foreign capitals and human rights groups. It did not deny that the meeting on Syria took place but said some content in the audio recording had been manipulated. Foreign ministry rooms in Ankara have now been swept for listening devices. Davutoglu said in a TV interview that the “revelations have only benefited the regime” in Syria.

He added that YouTube had refused a government request to take down the recording. “This is not freedom of thought,” the minister said. “This is a security threat. A state is entitled to take measures.” Sunday’s local elections are seen as a crucial popularity test for Erdogan, ahead of the country’s first direct presidential election in August and parliamentary polls scheduled for next year. Erdogan has embarked on a marathon campaign to support local candidates, leaving his voice hoarse and forcing him to cancel two events on Friday, according to his office.

Long hailed at home and abroad for driving strong economic growth, Erdogan has drawn criticism since a harsh police crackdown on protesters last June left eight people dead and thousands injured.

Since December, he has been hit an avalanche of online leaks linked to a corruption investigation that has forced three ministers to step down and left suspicion hanging over Erdogan’s own family.

At a rally on Thursday, Erdogan angrily condemned the latest YouTube leak as “a vile, cowardly, immoral act” and warned his political foes that “we will go into their caves”. He has often charged that Gulen followers inside the police and judicial apparatus form a parallel “deep state” and are behind the wire-tapping of thousands of prominent figures.

Despite the YouTube ban ordered by the Turkish Telecommunications regulator TIB, the platform remained accessible to many users in Turkey as of Friday morning.

YouTube was previously banned for two years until 2010 because of material deemed insulting to the country’s revered founding father Mustafa Kemal Ataturk.

An Ankara court overturned the Twitter ban on Wednesday, but the site remains offline while that ruling is appealed. Use of Twitter actually rose after the official ban, which many users circumvented by accessing Twitter via text messaging from their smartphones or using so-called virtual private networks.

The foreign minister said Friday that “Twitter is not the guardian of freedom. In the end, it is just a company. And it has to abide by the orders of Turkish courts.”