Image copyright Reuters Image caption Terrified students and staff who were barricaded inside the university are now reportedly free

Thirteen people, including seven students, died in an attack by gunmen on the American University in the Afghan capital Kabul, police say.

Two attackers were also shot dead by security forces nearly 10 hours after the assault began with an explosion on Wednesday evening.

Students and staff were trapped inside the university during the attack, which police said was now over.

No group has said it carried out the attack.

The victims also included three police and three guards. Thirty-five students and nine police were injured and about 750 students and staff were rescued, Kabul police chief Abdul Rahman Rahimi told the BBC.

Peace remains a distant dream in Afghanistan

Viewpoint: The toll of terror in Afghanistan and Pakistan

US to keep most troops in Afghanistan, Obama says

Police had described the attack, which began at about 19:00 local time (14:30 GMT), as "complex". Special forces were on the scene along with American military advisers.

One of those trapped inside the university for several hours was Massoud Hossaini, a Pulitzer Prize-winning photojournalist, who tweeted his experience and pleaded for help.

Image copyright Twitter

He later managed to escape and told the Associated Press news agency about the attack, which began with an explosion as he was in a classroom with 15 students.

"I went to the window to see what was going on, and I saw a person in normal clothes outside. He shot at me and shattered the glass," Mr Hossaini said, adding that he fell on the glass and cut his hands.

The students then barricaded themselves into the classroom. Mr Hossaini said at least two grenades were thrown into the classroom, wounding several classmates.

He and about nine students later managed to escape from the campus through an emergency gate.

"As we were running I saw someone lying on the ground face down, they looked like they had been shot in the back," he said.

Student Ahmad Mukhtar told the BBC that he was 100m (320ft) away from the university's main entrance on his way home when he heard "six or 10" shots and a "huge" blast.

The explosion created so much light that it momentarily lit up the surrounding area, he said.

"I climbed a six-metre wall to escape," Ahmad said.

Other trapped students and staff tweeted or posted on Facebook their desperate pleas for help.

Image copyright Facebook Image caption One trapped person blamed the Taliban for the attack

Image copyright AP Image caption Afghan forces rushed to the scene after the blast and gunfire were heard

Image copyright AP Image caption Emergency personnel evacuated the wounded

The attack comes two weeks after two university staff - one American, one Australian - were kidnapped by unknown gunmen. Their whereabouts remain unknown.

The American university, which first opened its doors to students in 2005, is a non-profit private university chartered in the US.

It offers English courses, adult professional qualifications and bachelor degree programmes, among others.

About 1,700 students are enrolled; many are adults who study part-time and also have jobs.