More than 80 years after his violent death, a Tajik king's remains have been buried in Kabul.

The burial on Thursday came amid tensions between his supporters and opponents that almost erupted into armed clashes, highlighting ethnic fault lines in Afghan society.

King Habibullah Kalakani, whose rise briefly interrupted the Pashtun dynasty in 1929, was executed after ruling for nine months.

He was laid to rest, along with close aides, after their remains were discovered in an unmarked spot below the hilltop mausoleum of the country's ethnic Pashtun dynasty.

His funeral, though, became a source of conflict between political leaders. Tajiks urged President Ashraf Ghani to give Kalakani a state burial, while Vice-President Abdulrashid Dostum insisted that the former royal could not be buried on a hilltop that he considers important to Uzbek heritage.

After many delays, Ghani eventually asked Abudullah Abdullah, the country's chief executive, to deal with the matter, fearing that his approval would upset Pashtun nationalists and a small but vocal secular community.

In the officially sanctioned history of Afghanistan, Kalakani is described as an illiterate highway robber who toppled reformist monarch King Amanullah, only to be deposed by Nadir, a cousin of the ousted king.

Kalakani was arrested and executed with all of his close aides, their bodies hanged in public and later dumped in a mass grave. This version of history is favoured by the Pashtun nationalists and secularists in Afghanistan.

However, for the Tajiks and the religious people of Afghanistan, Kalakani was a devout Muslim who opposed the secular policies of the "westernised" Amanullah.

He led an Islamic rebellion against Amanullah, who had unveiled his wife and ordered Afghans to wear western clothes.

Tense standoff

Kalakani was imprisoned when King Nadir Khan broke an amnesty deal that was written and signed on the Quran - an act of betrayal according to Tajiks.

After deposing Kalakani, Nadir declared himself king - only to be assassinated by a student in 1933.

Today, 87 years after Kalakani's death, the two contending versions of history almost tipped Kabul into ethnic violence.

As the funeral procession made its way to the cemetery on the hilltop of Sharara, armed groups loyal to the secular, Uzbek leader Dostum blocked the mourners. 

Sharara is one of the many hills in Kabul lying in a Tajik-populated quarter of the city.

But Dostum, also a former general, regards Sharara as his private property, despite there being a large public graveyard there.

"There are other places that he [Kalakani] could be buried, I was not consulted about this burial," Dostum said in videos posted on social media. "If all the Turkic population of Afghanistan get killed, I will not allow him to be buried on this hill top."

Security came out in force to try and ease tensions amid a dispute over King Kalakani's burial [Al Jazeera]

In the same video, a Pashtun man can be heard calling out to Dostum: "We are prepared to bring a thousand men from Logar province to support you."

The tense standoff continued for more than six hours, with Dostum's men standing firm as thousands of Tajik mourners threatened to take the hilltop by force.

"We will not accept this, the situation has become militarised, whoever has guns bring it now," said Gul Haidar, an influential Tajik commander, in videos posted on social media.

"Keep calm!" Saleh Registani, another influential Tajik leader and member of the parliament, told the crowd.

Gunshots were fired as pallbearers carrying the remains of Kalakani and his companions approached the site, leaving at least three people wounded, the AFP news agency reported.

'Funeral by Islamic law'

In another video posted on social media, Fazul Minallah Moumtaz, a representative of the Islamic party of Afghanistan (Hizb-e-Islami of Afghanistan), stands in the middle of the crowd and urges people not to turn the event into an ethnic and political dispute.

Gulbuddin Hekmatyar, a Pashtun religious leader opposed to the current government, heads that party.

Q&A: Afghanistan's Tajiks plea for federalism

Moumtaz said: "My dear brothers, do not let this event turn into a tribal and political dispute. [Kalakani] was a great Muslim. This event is a religious event and Islamic law urges us to have a funeral for him. We have gathered for the sake of Islam nothing more."

Dostum was eventually persuaded by Tajik leaders to back off, averting a bloody ethnic confrontation. 
Kalakani and his companions were buried on the hilltop cemetery late in the night.

Critics on social media accused Pashtun nationalists of inciting Dostum to antagonise the Tajiks on a historic day.

Follow Hashmatallah Moslih on Twitter: @hashmat_m

Tajik King Kalakani and his aides were executed in 1929 [Al Jazeera]

Source: Al Jazeera News