KABUL (Reuters) - Afghanistan President Ashraf Ghani on Sunday entered the 2019 presidential race after forging an alliance with a staunch critic to challenge his former governing partners at a time when the Taliban has shut him out of talks to end more than 17 years of war.

Afghanistan's President Ashraf Ghani speaks to the media after arriving to register as a candidate for the upcoming presidential election at the Afghanistan's Independent Election Commission (IEC) in Kabul, Afghanistan January 20, 2019.REUTERS/Omar Sobhani

Ghani, 69, is seeking a second term amid the war with the hardline Islamic militants and ongoing peace talks between the United States and the Taliban, in which his government complains it has been sidelined.

On Sunday Ghani registered as a presidential candidate for the July election, facing competition from his one-time officials who have formed new alliances.

Independent analysts said Afghanistan’s political landscape has been thrown into turmoil by the nominations and shifting loyalties.

A day earlier former warlord Gulbuddin Hekmatyar announced he was running for president, with the Afghanistan Chief Executive Abdullah Abdullah, who currently holds a power-sharing agreement with Ghani, formally entering the race on Sunday morning.

In a televised announcement, President Ghani, accompanied by his wife and political allies, listed his National Unity government’s achievements during the five-year term, including his consistent offer to hold unconditional peace talks with the Taliban.

“I started the peace initiative and our team will bring stable and long-lasting peace to the country,” he said, adding that if the Taliban consider themselves Afghans they “should come and talk to us”.

Slideshow ( 10 images )

Ghani’s critics say the previous presidential election in 2014 was fraught with irregularities, but the American government backed the Western-educated leader to rule the country while Washington wound down the U.S. military presence in favor of an advisory role to Afghan forces in the war.

But in the past four years, Western diplomats said they found Ghani to be an unrealistic micromanager who had failed to assess the security crisis or build political consensus to govern far-flung provinces.

The Taliban, has steadily carved out territorial gains since 2014, leaving Ghani’s government in control of less than two thirds of the country. Islamic State also has an established presence in the east of the country.

Suicide attacks targeting Afghan forces, government officials and expatriates have not subsided.

Last year Washington appointed Afghan-born diplomat Zalmay Khalilzad to start direct peace talks with the Taliban. Khalilzad has met Taliban leaders at least three times but disagreement over the agenda and the Taliban’s refusal to meet representatives from Ghani’s government has stalled the talks in recent weeks.

“Ghani could have made a dignified exit from politics and committed himself to the peace process, but instead he has formed an alliance with his main opponent to secure a second term,” said one Western diplomat in Kabul, asking to remain anonymous.

On Saturday Interior Minister Amrullah Saleh stepped down from his position to join the Ghani’s team as a vice-presidential candidate. Ghani, an ethnic Pashtun, had appointed Saleh, once seen as a significant rival, in an effort to neutralize his political opponents and shore up support from Afghanistan’s ethnic Tajiks, among whom Saleh commands strong backing.

“The most fundamental shift in Kabul politics recently has been the muddying of the waters during the presidential candidate nominations,” said Graeme Smith, a consultant for the International Crisis Group

Smith said the rural-urban divide in which major cities favored Ghani while his opponents received backing from provincial strongholds had been eroded. “Those clear lines have been blurred,” he said.

Senior electoral officials, who have been accused of failing to conduct free and fair parliamentary elections last year, said they are committed to stick to the deadline but the security situation could force them to delay polls by two months.