The assault at around 6:30 p.m. local time (10 a.m. ET) on Wednesday began with a large explosion that officials said was a car bomb followed by gunfire, as suspected militants battled into the complex where foreign staff and dozens of pupils were working.
Details of casualties are still scarce, but one person, reportedly a guard, was killed and at least 14 students were wounded. It was not clear whether foreigners were among those hurt.
Elite Afghan forces surrounded the walled compound and eventually worked their way inside, according to a senior interior ministry official.
The ministry's spokesman, Sediq Sediqqi, said late on Wednesday that two gunmen were hiding in the university building.
Early on Thursday, Kabul police chief Abdul Rahman Rahimi told Reuters that the area was quiet and that security forces were looking to flush out any remaining gunmen.
"We are inside buildings and a clearance operation is ongoing. We do not know if any attacker or attackers are still alive."
He declined to speak further, saying the light from his cell phone could make him a target for any assailants at large.
Terrified students recounted barricading themselves in classrooms or jumping from the second floor in order to escape. Most appeared to have got away.
"Many students jumped from the second floor, some broke their legs and some hurt their head trying to escape," Abdullah Fahimi, a student who escaped, told Reuters. He injured his ankle making the leap.
"We were in the class when we heard a loud explosion followed by gunfire. It was very close. Some students were crying, others were screaming."
Ahmad Mukhtar, who also fled, said the gunmen had got into the university buildings despite security measures including armed guards and watchtowers.
"I finished my class and was about to leave when I heard a few gunshots and a huge explosion, followed by more gunfire," he said. "I ran toward the emergency exit with other students, climbed the wall and jumped outside."
Islamist militant groups, mainly the Afghan Taliban and a local offshoot of Islamic State, have claimed a string of recent bomb attacks aimed at destabilizing the country and toppling the Western-backed government of President Ashraf Ghani.
No one has taken responsibility for the university raid.
It was the second time this month that the university or its staff had been targeted.
Two teachers, an American and an Australian, remain missing after being abducted at gunpoint from a road nearby on Aug. 7.
The American University of Afghanistan has about 1,700 students and advertises itself as the country's only not-for-profit, "non-partisan", co-educational university.
It opened in 2006 and caters to full-time and part-time students.
Taliban insurgents control large swathes of Afghanistan, and local armed forces are struggling to contain them, especially in the provinces of Helmand to the south and Kunduz to the north.
NATO ended its combat mission in December 2014, but thousands of troops remain to train and assist Afghan forces, while several thousand more U.S. soldiers are engaged in a separate mission focusing on al Qaeda and Islamic State.
The United States said it was closely monitoring the situation in Kabul following the university attack, and that forces from the U.S.-led coalition were involved in the response in an advise and assist role.
State Department spokeswoman Elizabeth Trudeau said the U.S. Embassy was working to account for all of its personnel and to locate and assist any U.S. citizens affected by the attack.