Scores of people were killed and wounded on Saturday evening when a suicide bomber detonated his explosives in a packed wedding hall in Kabul.
ISIS claimed responsibility for the attack in a statement posted on a website linked to the extremist group on Sunday. It said the bombing was carried out by a Pakistani militant.
Officials put the death toll at 63 killed in the attack shortly before midnight with at least 182 injured, although the numbers could rise as a relative of the groom said 1,200 people had been invited to the wedding.
The UAE's Ministry of Foreign Affairs and International Co-operation denounced the "cowardly attack" in the "strongest terms" and said it stood with Afghanistan in its fight against terrorism.
Afghan weddings are epic and vibrant affairs, with hundreds or often thousands of guests celebrating for hours inside huge wedding halls, in which men are usually segregated from women and children.
The explosion ripped through the Dubai City hall on the capital’s western edge, a mainly Shiite Hazara minority community.
Shiite Muslims are frequently targeted in Afghanistan, particularly by ISIS, which is also active in Kabul.
The Taliban denied any involvement in the attack.
Before ISIS claimed responsibility for the bombing, Afghan President Ashraf Ghani said on Sunday that the Taliban could not escape blame for a “barbaric” suicide bomb attack.
“The Taliban cannot absolve themselves of blame for they provide a platform for terrorists,” Mr Ghani said in a post on Twitter.
The bombing shattered a period of relative calm in the city.
Mohammad Farhag, who had been at the wedding, said he was in the women’s section when he heard a huge blast in the men’s area.
“Everyone ran outside shouting and crying,” Mr Farhag said.
“For about 20 minutes the hall was full of smoke. Almost everyone in the men’s section is either dead or wounded.”
He said that two hours after the blast, bodies were still being removed from the hall.
A video showed a man outside the hall with bloodstains on his clothes, his voice breaking as he explained that he was searching for his brothers.
A witness said the attacker set off the explosives near the stage where children had gathered.
Gul Mohammad, who saw the blast, said everyone near by had been killed.
Interior Ministry spokesman Nusrat Rahimi said dozens of people were dead or wounded.
The bombing sent a wave of grief through a city accustomed to atrocities.
“This heinous and inhumane attack is indeed a crime against humanity,” Afghanistan’s Chief Executive, Abdullah Abdullah, wrote on Twitter.
Ahmad Shuja tweeted: “This was a wedding. Imagine two family groups gathered for a celebration now bearing such unimaginable, paralysing loss."
Insurgents have periodically struck Afghan weddings, which are easy targets because they often lack rigorous security precautions.
On July 12, at least six people were killed when a suicide bomber attacked a wedding ceremony in the eastern Afghan province of Nangarhar. ISIS, which has a growing presence in the region, claimed responsibility.
On August 7, a Taliban car bomb aimed at Afghan security forces was detonated on the same road in a busy west Kabul neighbourhood, killing 14 people and wounding 145 – most of them women, children and other civilians.
Kabul’s huge, brightly lit wedding halls are centres of community life in a city weary of decades of war, with thousands of dollars spent on a single evening.
“Devastated by the news of a suicide attack inside a wedding hall in Kabul," tweeted Sediq Seddiqi, a spokesman for Mr Ghani.
"A heinous crime against our people. How is it possible to train a human and ask him to blow himself up inside a wedding?"
The wedding halls also serve as meeting places, and in November at least 55 people were killed when a suicide bomber sneaked into one being used by hundreds of Muslim religious scholars to mark the birthday of the Prophet Mohammed.
The latest attack came a few days after the end of Eid Al Adha, with Kabul residents visiting family and friends days before Afghanistan marks its 100th independence day on Monday.
The blast comes at a greatly uncertain time in Afghanistan as the US and the Taliban come close to a deal to end almost 18 years of war, America’s longest conflict.
The US special envoy leading the talks, Zalmay Khalilzad, said the attack showed the need to accelerate efforts to reach a deal with the Taliban, to help defeat ISIS.
The Afghan government has been sidelined from the discussions, and Mr Seddiqi said earlier on Saturday that his government was waiting to hear results of US President Donald Trump’s meeting Friday with his national security team about the negotiations.
Top issues include a US troop withdrawal and Taliban guarantees not to let Afghanistan become a launching pad for global terrorist attacks.
Washington and Kabul are also reportedly in talks to agree on their continuing relationship, in a bid to reassure Afghan government allies that America would not abandon it.
While the Taliban this year pledged to do more to protect civilians, it continues to stage deadly attacks against Afghan security forces and others in what is regarded as an attempt to strengthen its position at the negotiating table.
The conflict continues to take a horrific toll on civilians.
Last year more than 3,800 people, including more than 900 children, were killed in Afghanistan by the Taliban, US and allied forces, the ISIS affiliates and others, the UN said.