By Tulay Karadeniz

ANKARA (Reuters) - Turkey's President Tayyip Erdogan said he did not welcome a decision by the country's powerful spy chief to quit and run for parliament, signaling a possible rift among the ruling elite over plans for looming elections.

Erdogan's reaction to the move by Hakan Fidan, one of his main allies, surprised analysts who predicted the intelligence chief would stand in June elections, depicting it as part of a plan to strengthen the ruling party's power base in parliament.

"I don't view his candidacy positively. I said this to the prime minister," Erdogan told reporters at Istanbul airport on Sunday.

The president did not spell out his reasons. But analysts suggested Erdogan may have intervened because he had come to rely on Fidan at the helm of the MIT intelligence agency.

"Hakan Fidan is Erdogan’s man in Turkey’s intelligence community. He is at the center of the Kurdish peace talks ... and Turkey’s Syrian policy. Who can replace him?" said Jonathan Friedman, of political risk consultancy Stroz Friedberg.

The Turkish constitution demands that the president remains impartial, and Erdogan acknowledged Fidan's candidacy was a matter for loyalist Prime Minister, Ahmet Davutoglu.

"I have no authority to interfere in that (decision). I don't have the right," the president said.

But Erdogan has made little secret of his determination to keep a firm grip on politics and the ruling AK Party since he ascended to the presidency from the office of prime minister last year.

Any split between Erdogan and Davutoglu would concern investors, said Friedman, "because if they have a falling out, then all bets are off for Turkey’s political stability."

The opposition has regularly criticized Erdogan for continuing to involve himself in daily politics.

Fidan's resignation was one of several among senior officials planning to run for the AKP in the June election, including finance ministry undersecrectary Naci Agbal, viewed as a ministerial candidate.

Story continues

Aydin Unal, Erdogan's speechwriter, has also quit to run for parliament.

Fidan, who has so far made no comment on his resignation, had been tipped by many as a potential foreign minister.

Since taking over at MIT in 2010, Fidan has been central to tackling a hacking scandal in which secretly taped conversations suggesting wrongdoing by top officials were leaked online.

Erdogan dismissed the scandal as an attempt to unseat him by supporters of his former ally turned rival, U.S.-based Muslim cleric Fethullah Gulen.

(Additional reporting by Orhan Coskun; Writing by Jonny Hogg; Editing by Andrew Heavens and Robin Pomeroy)