Kabul was plunged into mourning Sunday after its deadliest attack for 15 years killed 80 people and left hundreds maimed, reigniting concern that the Islamic State group was seeking to expand its foothold in Afghanistan.

Tempers were frayed a day after the twin bombings that tore through crowds of Shiite Hazara protesters, as many anxiously searched hospitals and morgues, looking among the mutilated bodies for missing relatives.

The attack in the majority Sunni country highlighted the risk of sectarian disharmony in a nation that has largely avoided the bloody strife between Sunnis and Shiites that plagues much of the Muslim world.

"I promise you that I will avenge the blood of our loved ones on the perpetrators of this crime, wherever they are," President Ashraf Ghani said, declaring Sunday a national day of mourning.

The bombings occurred as thousands of Hazara protesters had gathered to demand that a multi-million-dollar power line pass through their electricity-starved province of Bamiyan, one of the most deprived areas of Afghanistan.

The site of the attack, which Ghani renamed as "Martyr's Square", remained littered with scorched metal, charred flesh and personal items including shoes, ID cards and protest banners with messages such as "Don't eliminate us".

"We came here to ask for our rights but instead received death," said Mohammad Mahdi, whose young brother was killed in the attack.

Many protesters defiantly camped at the site overnight, holding candlelight vigils and reciting Koranic verses even though the government announced a 10-day ban on public gatherings on security grounds.

Dozens of graves were dug with shovels and pickaxes at a nearby hilltop cemetery, where coffins were brought in, draped in traditional burial shrouds, for emotionally-charged funeral ceremonies.

Many who survived with grievous wounds overwhelmed city hospitals, with reports of blood shortages and urgent appeals for donors swirling on social media.

Story continues

"The lines of Afghan men and women who queued to donate blood for their injured compatriots was a poignant indicator of the Afghan peoples' resilience and solidarity in the face of terrible violence," the United Nations said.

- 'Heinous attack' -

IS, which controls territory across Syria and Iraq, claimed the bombings in a statement carried by its affiliated Amaq news agency, calling it an attack on a "gathering of Shiites".

The devastating attack in the capital represents a major escalation for IS, which so far has largely been confined to the eastern province of Nangarhar where it is notorious for brutality including beheadings.

The Afghan government is currently in the middle of an operation backed by NATO airstrikes against IS in Nangarhar, after Ghani earlier this year claimed that the group had been defeated.

NATO this month said the group's influence was waning as it steadily lost territory, with fighters largely confined to two or three districts in the province from around nine in January.

"There is no doubt that IS is under intense pressure in Nangarhar, and they are desperate to reassert themselves with attacks such as the one in Kabul," analyst Ahmad Saeedi told AFP.

The Taliban, who are in the middle of their annual summer offensive and are more powerful than IS, strongly denied any involvement in Saturday's attack.

The National Directorate of Security, Afghanistan's main intelligence agency, said the attack was masterminded by Abu Ali, an IS commander in Nangarhar's volatile Achin district.

The bombings, which the interior ministry said killed 80 people and left 231 others wounded, mark the deadliest single attack in Kabul since the Taliban were toppled from power in a 2001 US-led invasion.

The killings sparked an avalanche of global condemnation, with the United Nations labelling the direct assault on civilians a "war crime".

"This heinous attack was made all the more despicable by the fact that it targeted a peaceful demonstration," the White House said.