KABUL (Reuters) - A former ally of Afghan President Ashraf Ghani who was one of the Western-backed government’s most influential security officials before resigning unexpectedly this year, has announced he plans to run in next year’s presidential election.

Mohammad Hanif Atmar, the former national security adviser who was once considered the second-most powerful official in the government, will be running against his former boss in the election, due on April 20.

With an increasingly confident Taliban in control of large areas of Afghanistan and violence across the country, the election is shaping up as a major challenge to the government, with speculation rising that the poll may have to be delayed.

Campaigning has also been complicated by efforts to start a peace process with the Taliban, who have ruled out talking with Ghani’s government, which they consider an illegitimate foreign-imposed regime.

Announcing his candidacy in an interview with Tolo News television late on Wednesday, Atmar said he would welcome talks with the Taliban, on condition that fundamentals of the constitution, including human and women’s rights, were unchanged.

“We welcome their return to the system for permanent and stable peace, but a Taliban regime is not acceptable,” he said.

An ethnic Pashtun former intelligence officer in the communist government who lost a leg fighting the anti-Soviet Mujahideen in the 1980s, Atmar is also well-liked by Western officials.

He was a central figure behind a 2014 bilateral security agreement with the United States and a 2016 reconciliation accord that allowed former warlord Gulbuddin Hekmatyar to return to Kabul and rejoin the political mainstream.

He stepped down from his position in late August, citing serious differences over the president’s approach to the peace process.