ANKARA (Reuters) - The head of Turkey’s intelligence service, Hakan Fidan, one of President Tayyip Erdogan’s closest confidants, has resigned to run in a parliamentary election in June, two senior Turkish officials said on Saturday.

Fidan, who played a key role in trying to stop the hacking of confidential state communications during a corruption scandal implicating Erdogan’s inner circle last year, has been widely seen as a potential future foreign minister.

Fidan’s move into politics would give Erdogan, who became Turkey’s first popularly-elected head of state last August, another loyal ally in the top ranks of the ruling AK Party, helping him cement his grip on government.

“He will make the best of any job in any place,” Prime Minister Ahmet Davutoglu was quoted by the Hurriyet newspaper as saying this week, describing Fidan as “brave and valiant”.

His departure comes as Turkey faces a range of intelligence challenges, from its role in the international coalition against Islamic State militants across its southern border in Syria and Iraq to the threat posed to its own security by returning jihadists.

The two senior officials said Muhammed Dervisoglu, undersecretary of public order and security, would be most likely to replace Fidan. The intelligence agency could not immediately be reached for comment.

Fidan was appointed by Erdogan, then prime minister, as head of the National Intelligence Agency (MIT) almost five years ago. He has played a key role in peace talks with Kurdistan Workers Party (PKK) militants, who have waged a three-decade insurgency for greater Kurdish autonomy in Turkey’s southeast.

POWER STRUGGLE

The former foreign policy adviser has also been a central figure in the power struggle between Erdogan and Muslim cleric Fethullah Gulen, a former Erdogan ally based in the United States whose network of followers wields influence in Turkey’s police and judiciary.

Erdogan blames Gulen for orchestrating the corruption scandal as part of an attempted coup. Fidan’s MIT, unlike the police, has remained firmly under Erdogan’s control.

Fidan’s appointment as foreign minister would be likely to further damage strained relations with Israel. When Fidan was appointed intelligence chief, then-Israeli defense minister Ehud Barak described him as a “friend of Iran”, pointing to a shift in Ankara’s regional interests.

Turkey had been the Muslim power closest to the Jewish state, a friendship largely based on military cooperation and intelligence sharing, until relations soured after the Israeli navy killed nine Turks aboard an aid ship that tried to run the Gaza Strip blockade in 2010.