Afghan officials say a suicide attack outside a Shi'ite mosque in Kabul killed at least 29 people and wounded dozens, as people in the capital celebrated the new year holiday Norouz. .

"Unfortunately, 29 Afghan citizens lost their lives and 52 others were wounded in this incident," Health Ministry Wahidullah Majrooh told RFE/RL.

Nusrat Rahimi, a deputy spokesman for the Interior Ministry, told RFE/RL that most of the victims of the attack claimed by the extremist group Islamic State (IS) were civilians.

The bomber was spotted by police as he attempted to enter a large gathering for the Norouz celebration in Kabul's Kart-e Sakhi mosque, Mohammad Salem Almas, head of criminal investigations in the Kabul police, told RFE/RL.

The attacker detonated the explosives that he was carrying before entering the mosque, Almas said.

Kabul police chief Daud Amin said the attacker managed to slip past a checkpoint on his way to the mosque.

"We have taken security measures in the wider area and specifically around the Kart-e Sakhi mosque," Amin said. "Unfortunately, the suicide attacker passed through the first checkpoint."

“We are investigating how he did that. We have ordered all personnel at the checkpoint to be taken in for questioning,” he added.

IS claimed responsibility for the attack via its propaganda arm Amaq, the SITE Intelligence Group said.

"The martyrdom operation carried out with a suicide vest struck a Shi'ite gathering during their Norouz holiday celebrations in the city of Kabul," Amaq said.

UN envoy to Afghanistan Tadamichi Yamamoto issued a statement condemning the "egregious" attack."

"Those who have organized and enabled this attack must be brought to justice and held to account, Yamamoto said in his statement.

"On behalf of the United Nations in Afghanistan, I express our deep condolences to the families of the victims and wish a speedy recovery of the injured."

The blast, the latest in a series to have hit Shi'ite targets in the capital, came as people were walking away from the mosque, near the city's main university.

The Kart-e Sakhi mosque was a target of previous militant attacks.

There was no immediate claim of responsibility for the attack but Taliban and Islamic State (IS) militants have increasingly targeted Kabul in recent months. IS militants view members of the Shi'ite minority as apostates.

Norouz is a national holiday, widely celebrated in Afghanistan, but has also faced opposition from some fundamentalist Muslims, who say it is un-Islamic.

Afghan officials fear that the death toll from the attack may rise.

The latest explosion to hit Kabul highlighted the threat to the city despite government promises to tighten security following a series of brazen militant attacks in Kabul.

Almost 100 people were killed in January in Kabul in a Taliban suicide attack in a secure zone home to government offices and foreign embassies.

Also in January, Taliban militants killed 22 people in a luxury Kabul hotel.

With reporting by Reuters, AFP, AP, and dpa