By James Mackenzie
KABUL (Reuters) - Taliban advances and a shootout between gunmen from rival ethnic groups in Kabul that carried echoes of Afghanistan's 1990s civil war have underlined the threats facing President Ashraf Ghani two years after he came to power.
The skirmish earlier this month in the capital, sparked by a row over plans to re-bury a former Tajik king, was relatively minor by Afghan standards, but also a rare open display of hostility between ethnic groups that often simmers under the surface yet defines decades of conflict.
At the same time, the Taliban have stepped up operations only weeks before a major conference of international donors to Afghanistan in Brussels.
Last Thursday, the militant movement's fighters appeared to walk right into the center of Tarin Kot, capital of the central province of Uruzgan, and though the insurgents were pushed back, residents say it is now a ghost town of empty roads and shuttered shops.
The fighting in Uruzgan and other provinces including Helmand in the south and Kunduz in the north, plus a string of attacks in Kabul in the last few months, provide stark evidence of the Western-backed government's inability to guarantee security, 15 years after the fall of the Taliban.
NATO and Afghan security officials are on alert for more attacks after the Eid holiday this week.
So far, opposition groups have avoided calling openly for Ghani to go, wary of creating a power vacuum at a time when the Taliban insurgency is gaining in intensity.
But this month is the deadline by which the government was to have introduced a new structure following the disputed election of 2014, which forced Ghani to divide power with his rival, Abdullah Abdullah, in an awkward "unity" administration.
The deadline is set to expire with none of those changes in place, which experts say undermines Ghani's legitimacy at a time when the Afghan public is far from happy with his performance.
"It's a manageable situation, but the risk of it getting out of hand becomes acute around September," said Scott Worden, director of Afghanistan and Central Asia Programs at the United States Institute of Peace in Washington.
Ghani has the support of the United States, Afghanistan's key ally; Secretary of State John Kerry said in April that Washington does not consider the deadline binding and expects the government to serve a full five-year term.
Whether it lasts that long may depend on how Ghani gets on with his chief executive Abdullah, who recently accused the president of being unwilling to listen to his ministers and unfit to hold office.
Senior aides say they have ironed out their differences after a series of meetings, and government unity is undamaged.
"There's an environment of better understanding and agreement," said government spokesman Shahhussain Murtazawi. "What you see in the media doesn't reflect reality."
While security and a lack of jobs remain top priorities, the two must also keep a lid on ethnic tensions that flared up during the dispute over the reburial of Habibullah Kalakani, a Tajik bandit who briefly reigned as king in 1929.
Although eventually resolved, the dispute saw Tajik supporters exchanging fire with those backing Vice President Rashid Dostum, an ethnic Uzbek with his own large militia, who objected that the proposed burial site had connections with their own history.
With the opposition unwilling to be seen destabilizing the government, the threat of an immediate political crisis appears to have waned, though risks remain.
"Barring accidents, I don't think anything decisive will happen by the end of September," said Umer Daudzai, former interior minister and leader of the opposition Afghanistan Protection and Stability Council.
But he added: "Accidents have always influenced things in Afghanistan a lot."
The Kabul attack in July on a demonstration by members of the mainly Shia Hazara community, which killed more than 80 people, had already raised fears of ethnic bloodshed, beyond the militant violence that Ghani and the Americans hope to contain.
And the latest dispute has fueled bitter exchanges not only between Tajiks and Uzbeks, but also Tajiks and Pashtuns, the country's largest ethnic group, as well as Hazaras, who have faced a long history of discrimination.
Shrill rhetoric from different ethnic groups in the wake of the clash has fed into social media and local television stations, which have been awash with angry comment.
How this will be judged by foreign donors who meet in Brussels in October to approve support for Afghanistan remains unclear, although they have said they would continue to provide the billions of dollars needed over the coming years.
"We have achieved most of the goals set for us and we have time to reach the remaining goals," Murtazawi said.
Seen by critics and some ministers as a remote technocrat given to micromanaging, Ghani lacks a clear power base.
While he may be able to count on U.S. and international backing, his own people doubt his ability to provide adequate security and enough jobs.
Renewal of ethnic rivalries risks boosting the power of regional and ethnic strongmen like Dostum, who scorn efforts to impose central control on their local power bases and regularly complain of being shut out by Ghani.
"The problem is that Ghani's government is restricted to Kabul; he has little control and support outside Kabul," said one foreign diplomat. "But it is the regional leaders who will have a big say in the upcoming political challenge."
(Additional reporting by Hamid Shalizi, Mirwais Harooni, Abdul Saboor and Rupam Nair; Editing by Mike Collett-White)