Afghan security forces killed two gunmen who attacked the American University in Kabul, police said early on Thursday, ending an assault on the compound that killed at least one person and sent hundreds of students fleeing in panic.

The attack at around 6:30 p.m. 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 pupils were working.

Elite Afghan forces surrounded the walled compound and eventually worked their way inside, according to a senior interior ministry official.