A siege at Kabul University is over, with at least 19 dead and 22 wounded, Afghanistan’s Interior Ministry has said.

The ministry’s spokesman, Tariq Arian, said there were three attackers involved in the storming of the campus, all of whom were killed.

The university was hosting a book fair attended by the Iranian ambassador to Afghanistan when the gunmen attacked, sparking a siege that lasted hours.

No group immediately took responsibility for the attack, though the Taliban issued a statement saying they were not involved.

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

Ahmad Samim, a university student, told journalists he saw militants armed with pistols and assault rifles firing at the school, the country’s oldest with some 17,000 students.

He said the attack happened at the university’s eastern side where its law and journalism faculty teach.

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

Iranian diplomats have been targeted previously by attacks in the country.

In 1998, Iran held the Taliban responsible for the deaths of nine Iranian diplomats who were working in its consulate in northern Afghanistan and sent reinforcements to the border that Iran and Afghanistan share.

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

Violence has been relentless in Afghanistan even as the Taliban and a government-appointed negotiation team discuss a peace agreement to end more than four decades of war in the country.

The talks in Qatar have been painfully slow and despite repeated demands for a reduction in violence, the chaos has continued unabated.

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

Last month, the so-called Islamic State group sent a suicide bomber into an education centre in the capital’s Shiite dominated neighbourhood of Dasht-e-Barchi, killing 24 students and injuring more than 100.