Mourners carry the body of a victim of a mosque bombing in Kabul, Afghanistan, Thursday, Aug. 18. 2022. AP
The number of bombings across Afghanistan has declined since the Taliban returned to power in August last year, but several attacks -- many targeting minority communities -- have rocked the country in recent months, including some claimed by the jihadist Islamic State group.
No group has claimed responsibility for Wednesday evening's blast at Kabul's Sediqia Mosque, which has an adjoining madrassa.
"He was my cousin; may God forgive him," said a neighbourhood resident who gave his name as Masiullah, describing how he learnt of a relative's death in the blast.
"One year had passed from his marriage, he was 27 years old and his name was Fardin... he was a good person."
Kabul police spokesman Khalid Zadran said 21 people were killed and 33 wounded.
The Italian non-governmental organisation Emergency, which operates a hospital in Kabul, said Wednesday evening it had received 27 victims, including three fatalities.
Most of the patients were suffering "shell and burn injuries", it said via email.
In a later tweet, the hospital said five children were among those it treated, including a seven-year-old.
Local hospitals contacted by AFP said they were not permitted to provide details of casualties they had treated.
Taliban officials insist they have full control of security in the country, but frequently deny or downplay incidents reported on the country's vibrant social media.
They have also taken recently to preventing local and foreign media from covering the aftermath of attacks -- sometimes violently -- and on Thursday armed Taliban fighters prevented journalists from reaching the mosque site.
Wednesday's blast comes nearly a week after a suicide bomber killed top Taliban cleric Rahimullah Haqqani, along with his brother, at his madrassa in Kabul.
Haqqani was known for angry speeches against IS, which later claimed the attack.
The group has primarily targeted minority communities such as Shiites, Sufis and Sikhs.
The Taliban say they have defeated IS, but experts claim the group remains a key security challenge for the hardline Islamists.
While IS is a Sunni Islamist group like the Taliban, the two are bitter rivals and greatly diverge on ideological grounds.
The blast came as senior Taliban leaders on Thursday led a major gathering of more than 2,000 religious clerics and elders in the southern city of Kandahar, the movement's de facto power base.
In a statement sent to the media, a Taliban spokesman said "important decisions" would be taken at the conference but provided no other details.
The Taliban on Monday marked the first anniversary of their return to power following a turbulent year that saw women's rights crushed and a humanitarian crisis worsen.
Initially, they promised a softer version of the harsh Islamist rule that characterised their first stint in power from 1996 to 2001, but many restrictions have gradually been imposed.
The country is in economic crisis, with its overseas assets frozen by Washington and aid curtailed in order to keep funds out of the Taliban's hands.
No country has officially recognised the new government.