Dozens of people were killed when gunmen opened fire at a political rally in Kabul, the deadliest assault in Afghanistan since the US signed a withdrawal deal with the Taliban.
The attack, claimed by the Islamic State group, highlights a glaring lack of security in the Afghan capital just 14 months ahead of the scheduled withdrawal of all foreign forces.
It also calls into question a key element of the US-Taliban deal signed on 29 February - whether the Taliban can stop jihadists such as IS from running amok in Afghanistan after US forces pull out.
In a statement, IS said two brothers had targeted a "gathering of apostates" with machine guns and grenades.
The gunmen inflicted devastating carnage at the crowded event in west Kabul, killing 32 people and wounding 58 others, health ministry spokesman Wahidullah Mayar told AFP.
Interior ministry spokesman Nasrat Rahimi put the toll at 29 dead, with an additional 61 wounded. He said special forces units eventually killed the two gunmen.
The assault occurred at a commemoration ceremony for Abdul Ali Mazari - a politician from the Hazara ethnic group, most of whom are Shia Muslims.
The Sunni-extremist IS had claimed an attack on the same ceremony last year, when a barrage of mortar fire killed at least 11 people.
Mr Rahimi said gunfire had erupted from a construction site near the event.
Several top political officials were at the ceremony, including Afghanistan's chief executive Abdullah Abdullah.
The interior ministry later confirmed that all the high-ranking officials had been "safely evacuated."
"We left the ceremony following the gunfire, and a number of people were wounded, but I do not have any reports of martyred people for now," Hazara leader Mohammad Mohaqiq told Tolo News.
President Ashraf Ghani condemned the massacre as a "crime against humanity".
The attack came less than a week after the US and Taliban signed a deal that would result in the complete withdrawal of foreign troops in 14 months.
The withdrawal however depends heavily on the Taliban being able to control jihadist forces such as Al-Qaeda and IS.
If such groups remain, so too does the US military.
A US Forces-Afghanistan spokesman said the response to the attack was "Afghan led," but US personnel gave medical aid to the victims.
US Secretary of State Mike Pompeo insisted that despite the attack, violence in Afghanistan was "significantly down".
"The violence levels, they're still lower than they have been in the last five or six years," Pompeo told CNBC television.
"We see the path forward towards a peace and reconciliation opportunity."
He later condemned the "despicable" attack, saying in a statement that the peace process "presents a critical opportunity for Afghans to come together to build a united front against the menace of ISIS."
But since the deal was signed in Doha fighting has continued across Afghanistan, raising questions over whether the agreement would reduce violence and lead to talks between the Taliban and the Afghan government.
Afghan government officials and the Taliban are supposed to meet in Oslo next week, but talks are likely to be delayed over disagreement about a prisoner release.
The US-Taliban deal calls on the Afghan government to release as many as 5,000 Taliban prisoners before 10 March, when talks are supposed to start. President Ghani however has rejected that commitment.
The Taliban's political spokesman Suhail Shaheen said that the insurgents were ready for talks - but only if the prisoners were released.
"If the negotiations are delayed beyond the stated date, the responsibility will rest with the others," Mr Shaheen tweeted.
The Islamic State group, which follows a radical Sunni interpretation of Islam, first became active in Afghanistan in 2015.
It has claimed responsibility for a string of bombings, including several in Kabul targeting the city's Shiite community.
In recent months the group has suffered mounting setbacks after being hunted by US and Afghan forces, as well as Taliban offensives targeting their fighters.
At the United Nations, Secretary General Antonio Guterres condemned the attack and expressed his "deepest sympathies" to the families of the victims.
"Attacks against civilians are unacceptable and those who carry out such crimes must be held accountable," Mr Guterres said.
[ ===== DateLine ========== ]