Militants from so-called Islamic State stormed Kabul University as it hosted a book fair attended by the Iranian ambassador, sparking a siege and leaving at least 22 dead and 22 wounded.

Most of the casualties were students and there were fears the death toll could climb further with some of the wounded said to be in critical condition.

It was the second attack on an educational institution in Kabul in as many weeks.

The Taliban promptly issued a statement denying they took part in the assault, which came as the insurgents continue peace talks with representatives of the Afghan government, and later in the day, IS claimed responsibility for the attack.

As the attack unfolded, students and teachers were seen fleeing the part of the campus where law and journalism schools are located, while hand grenades exploded and automatic rifle fire could be heard. Afghan special forces surrounded the campus, shepherding teachers and students to safety.

Afghanistan
The siege went on for some time (AP Photo/Rahmat Gul)

The Interior Ministry’s spokesman, Tariq Arian, said all three attackers involved in the assault were killed.

IS said it targeted newly graduated “judges and investigators belonging to the apostate Afghan government” gathered at the campus, according to the SITE Intelligence Group, which monitors terror online messaging.

The IS statement claimed only two of its fighters were involved, and posted their photographs, which conflicted with the Afghan authorities’ report of three attackers. The claim did not indicate IS intended to target the Iranian envoy or the book fair.

Last week, IS also claimed responsibility for a brutal assault on a tutoring centre in the Afghan capital’s mostly Shiite neighbourhood of Dasht-e-Barchi that killed at least 24 students and wounded more than 100 others on October 24.

The peace negotiations between the Taliban and the Kabul government, known as intra-Afghan talks, were part of a deal the US signed with the insurgents in February. They are taking place in Qatar and are seen as Afghanistan’s best chance at peace – though daily bloodshed has continued.

Afghanistan
Gunfire erupted at the university in the Afghan capital (AP/Rahmat Gul)

Afghan media reported that a book exhibition was being held at the university and attended by a number of dignitaries at the time of the shooting. None of the dignitaries were reported hurt.

While Afghan officials declined to discuss the book fair, Iran’s semi-official ISNA news agency reported on Sunday that Iranian Ambassador Bahador Aminian and cultural attache Mojtaba Noroozi were to inaugurate the fair, which was hosting some 40 Iranian publishers.

Iranian state television reported that the attack occurred, but did not offer information on its officials.

Last year, a bomb outside of the Kabul University’s gates killed eight people and in 2016, gunmen attacked the American University in Kabul, killing 13.

Violence has been relentless, even as the talks in Qatar to end more than four decades of war in Afghanistan have been painfully slow, and despite repeated demands for a reduction in violence.