KABUL, Afghanistan -- Islamic State militants in Afghanistan stormed Kabul University on Monday as it hosted a book fair attended by the Iranian ambassador, sparking an hours-long gunbattle and leaving at least 22 dead and 22 wounded at the war-torn country's largest school.
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 Kabul's U.S.-backed government, with the aim to help the United States finally withdraw from Afghanistan. Later in the day, the Islamic State group 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. Scores of Afghan special forces surrounded the campus, shepherding teachers and students to safety.
The chaos subsided as the sun set over the Afghan capital and the Interior Ministry’s spokesman, Tariq Arian, said all three attackers involved in the assault were killed.
The Islamic State group 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 the IS intended to target the Iranian envoy or the book fair.
Last week, IS also claimed a brutal assault on a tutoring center in the Afghan capital's mostly Shiite neighborhood of Dasht-e-Barchi that killed at least 24 students and wounded more than 100 others on Oct. 24.
The peace negotiations between the Taliban and the Kabul government, known as intra-Afghan talks, were part of a deal Washington signed with the insurgents in February. They are taking place in the Gulf Arab state of Qatar, and are seen as Afghanistan's best chance at peace — though daily bloodshed has continued.
Five hours into the fighting on Monday, sporadic grenade explosions and automatic weapons fire still echoed down the empty streets surrounding the university's fenced compound. Afghan troops stood guard.
Ahmad Samim, a university student, told journalists he saw militants armed with pistols and Kalashnikov 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.
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 bookfair, Iran's semiofficial ISNA news agency reported Sunday that Iranian Ambassador Bahador Aminian and cultural attaché 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.
Iranian diplomats have been targeted previously in Afghanistan, incidents that dangerously escalated tensions between the two countries. In 1998, Iran held the Taliban responsible for the deaths of nine Iranian diplomats working in its consulate in northern Afghanistan, and sent reinforcements to the 950-kilometer- (580-mile-) long Iran-Afghan border.
The IS affiliate in Afghanistan has declared war on the country's minority Shiite Muslims and staged dozens of attacks since emerging in the region in 2014. A horrific attack earlier this year on a Kabul maternity hospital — also in the Dasht-e-Barchi neighborhood — was blamed on the Islamic State group. In that attack, militants killed 25 people, many of them newborn babies and mothers.
Schools have also been targeted in past attacks. Last year, a bomb outside of the Kabul University's gates killed eight people. 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.
The U.S.-Taliban deal in February allowed for the withdrawal of U.S. and NATO troops from Afghanistan and set the stage for the talks underway in Doha.
The architect of Washington’s agreement with the Taliban, Zalmay Khalilzad, returned last week to the region, citing deep disappointment at the escalating violence in Afghanistan. On Monday, Khalilzad was in neighboring Pakistan, where he met with the powerful army chief. Few details of the meeting have been released but it is widely believed Khalilzad was pressing for Pakistan’s help to push the Taliban to agree to a reduction in violence.
Even though their political office is based in Qatar, Taliban leadership councils are located in Pakistan, with Islamabad being critical to pressing the insurgents into peace talks.
Though Khalilzad and the Afghan government have been calling for a cease-fire or at the very least a reduction in violence, the Taliban have refused a truce, saying a permanent end to fighting would be part of the negotiations.
Pakistan's foreign ministry condemned Monday's attack in Kabul, calling it an “act of terrorism” that was particularly “despicable as it targeted an institution of learning." Last week, a suicide bomber attacked a religious school in Pakistan’s northwest on the border with Afghanistan, killing eight students and wounding more than 120.
Also on Monday, a vehicle hit a roadside mine in Afghanistan's southern Helmand province, killing at least seven civilians, most of them women and children, provincial governor spokesman Omer Zwak said.
Gannon reported from Islamabad. Associated Press writers Nasser Karimi and Amir Vahdat in Tehran, Iran, contributed to this report.