NEW DELHI: A bomb attack on the American University in Kabul has killed 12 people, including seven students.

The attack began 6:30 PM local time on Wednesday. Eyewitnesses say that a huge explosion was followed by gunfire, as militants stormed the complex where foreign students and staff were at work.

A senior interior ministry official says that Afghan forces surrounded the walled compound and eventually worked their way inside. Gunfire could be heard through the night and before dawn, which is when the operation concluded.

Kabul police chief Abdul Rahman Rahimi said seven students, three policemen and two security guards were killed during the attack. "The fight is over and at least two attackers are killed," a police official at the scene told Reuters Thursday morning.

Fraidoon Obaidi, chief of the Kabul police Criminal Investigation Department, told Reuters that police had evacuated between 700 and 750 students from the university, which is popular with Afghanistan's elite.

Several students took to Twitter to convey the horrors of the scenes unfolding whilst they were trapped and asked for help.

This is the second attack involving the university within a span of a month. Earlier in August, two teachers, an American and an Australian, were abducted at gunpoint from a nearby road. They remain missing.

The attack comes at a time when the Taliban and other groups have stepped up their offensive in the state. The attacks all represent the worsening security situation in conflict-torn Afghanistan. In the first six months of this year, 5,166 civilians were either killed or maimed in Afghanistan, a half-year record since counting began in 2009, a United Nations report published last week shows.

Between January and June this year, the human rights team of the UN Assistance Mission in Afghanistan (UNAMA) documented 1,601 civilian deaths and 3,565 injured civilians, an increase of four per cent in the total number of casualties compared to the first six months of 2015, according to the report, titled 'Afghanistan Midyear Report 2016; Protection of Civilians in Armed Conflict.'

The total civilian casualty figure recorded by the UN since 1 January 2009 through 30 June 2016 has risen to 63,934, including 22,941 deaths and 40,993 injured.

“The testimony of victims and their families brings into agonizing focus the tragedy of each one of the 63,934 people killed or maimed by this protracted conflict since 2009,” said UN High Commissioner for Human Rights Zeid Ra'ad Al Hussein in a press release.

This year's casualties include 1,509 children, 388 dead and 1,121 injured, a figure Zeid described as “alarming and shameful,” particularly as it represents the highest numbers of children killed or wounded in a six-month period since counting began in 2009.

There were also 507 women casualties, 130 killed and 377 injured.

The figures are conservative – almost certainly underestimated – given the strict methodology employed in their documentation and in determining the civilian status of those affected.

It is worth noting that civilian casualties have risen to record levels every year for seven years.