The attackers were targeting students and fired on them as they fled in the Afghan capital, one witness said.
“They were shooting at every student they saw,” Fathullah Moradi told Reuters, saying he had managed to escape through one of the university’s gates with a group of friends.
The Taliban said their fighters were not involved in the assault. No other group immediately claimed responsibility.
Witnesses said the attack followed an explosion in the area.
“At least 10 killed many others wounded,” the senior government official told Reuters on condition of anonymity as he was not authorized to speak to media.
Several attackers had entered the campus and were fighting with security forces, interior ministry spokesman Tariq Arian said.
At least 15 people were injured, a police source said.
NATO Senior Civilian Representative to Afghanistan Stefano Pontecorvo condemned the attack.
“This is the second attack on educational institutions in Kabul in 10 days. Afghan children & youth need to feel safe going to school,” he said in a statement.
An attack late last month on an education center in Kabul killed 24 people, mostly students.
Violence has plagued Afghanistan while government and Taliban negotiators have been meeting in Qatar to try to broker a peace deal and as the United States brings home its troops.