* Syria recording most serious in weeks of leaks
* Erdogan has blamed U.S.-based cleric for plot
* Wider clampdown expected after Sunday's polls
* Prominent newspaper editor quits
By Humeyra Pamuk
ANKARA, March 29 (Reuters) - Turkey has started an espionage investigation after a discussion between top officials on potential military action in Syria was leaked on YouTube, heralding a possible government crackdown on its political opponents after elections on Sunday.
The recording of the meeting between Turkey's intelligence chief, foreign minister and deputy head of the military was by far the most serious breach in weeks of highly sensitive leaks, a scandal which Prime Minister Tayyip Erdogan has cast as a plot to sabotage the state and topple him.
Erdogan and his aides have blamed the Hizmet movement of U.S.-based cleric Fethullah Gulen, a former ally whose followers have influence in the police and judiciary, of running a "dirty campaign" of espionage to implicate him in corruption ahead of crucial nationwide municipal elections on Sunday.
"Tomorrow we will teach those liars and slanderers a lesson," Erdogan told a jubilant crowd of supporters in Istanbul's working class Kartal district on Saturday, vowing his ruling AK Party would triumph at the polls.
Gulen has vociferously denied orchestrating the leak scandal, but those close to his network have said they fear a heavy crackdown once the local elections have passed.
Police overnight briefly detained Onder Aytac, a prominent writer and journalist known to be close to the Hizmet movement, on suspicion of having information about the bugging of the foreign ministry meeting, the Hurriyet newspaper said.
CNN Turk meanwhile reported Erdogan's lawyers asked prosecutors to take precautionary measures to stop both Aytac and Emre Uslu, a newspaper columnist, academic and former senior anti-terrorism police official, from fleeing abroad.
Aytac said in a statement on the Hizmet-affiliated Samanyolu news website that he had been asked whether he was a spy and how he had known so much about the content of the leaked recording, after he discussed it on a television programme.
"I made my assessment as an academic in that programme. They are trying to intimidate people who think like me in this election process," he said in the statement.
Government officials declined to comment on whether an investigation into the leak had begun, saying any probe would be a matter for the judiciary. The state prosecutor's office could not immediately be reached for comment.
"DECLARATION OF WAR"
Senior officials said in February that Turkey would launch a criminal investigation into an alleged "parallel state" backed by Gulen, which they accuse of orchestrating the graft scandal and illegally tapping thousands of phones over years.
Erdogan's government has already reassigned thousands of police officers and hundreds of prosecutors in a purge after the corruption investigation burst into the open on Dec. 17 with the detention of businessmen and three ministers' sons.
Gulen's network has said it is the victim of witch hunt.
Today's Zaman, a newspaper close to the network, said on Saturday Erdogan had filed legal complaints against its editor and deputy editor, as well as its contributors Aytac and Uslu and a former Istanbul police intelligence chief.
Meanwhile Fatih Altayli, editor-in-chief of the mainstream Haberturk newspaper who openly decried government pressure on the media in a television interview last month, said in a column on Saturday that he was stepping down.
"With great regret I see that an era of 'militant journalism' has started," he wrote, decrying what he portrayed as an increasingly polarised media landscape in Turkey with a lack of independent voices.
The corruption scandal and anti-government protests last summer have grown into one of the greatest challenges of Erdogan's 11-year rule, and his critics fear that what they see as his authoritarian instincts will only deepen if the AK Party puts in a strong showing in Sunday's polls.
A senior government official on Friday described the crisis as "one of the biggest in Turkish history".
The bugged Syria meeting involved intelligence chief Hakan Fidan discussing possible military operations in Syria with Foreign Minister Ahmet Davutoglu, Deputy Chief of military Staff Yasar Guler and other senior officials.
Erdogan denounced the leak as "villainous" while Davutoglu called the posting a "declaration of war," an apparent reference to the escalating power struggle with Gulen. (Additional reporting by Can Sezer in Istanbul and Gulsen Solaker in Ankara,; Writing by Nick Tattersall; Editing by Tom Heneghan)