At least 22 people have been killed by gunmen who stormed Kabul University before engaging security forces in an hours-long battle on Monday.
A spokesman for the Afghan interior ministry said the attack was eventually stopped when three gunmen were killed.
A regional Islamic State group claimed responsibility in a statement.
The attack began shortly before the expected arrival of government officials for an Iranian book fair and continued for several hours.
A further 22 people were wounded by the attackers.
Tuesday has been declared a national day of mourning by the government.
The Taliban denied involvement and condemned the attack shortly after it began on Monday. Hours later the Islamic State group issued a message on the Telegram app saying it had targeted “the graduation of judges and investigators working for the apostate Afghan government”.