At least 147 people, mostly students, have been killed in an assault by al-Shabab militants on a university in north-eastern Kenya.

Heavily armed attackers stormed Garissa University early on Thursday, killing two security guards then firing indiscriminately on students.

Four of the gunman were eventually surrounded in a dormitory, and died when their suicide vests detonated.

It is the deadliest attack yet by al-Shabab.

The militants singled out Christians and shot them, witnesses said.

More than 500 students managed to escape, 79 of whom were injured. A fifth gunman has reportedly been arrested.

Eric Wekesa, a student at Garissa, told Reuters he locked himself in his room before eventually fleeing.

"What I managed to hear from them is 'We came to kill or finally be killed.' That's what they said."

"It was horrible, there was shooting everywhere," another student, Augustine Alanga told the BBC's Newsday programme

He said it was "pathetic" that the university was only guarded by two police officers.

Attack as it happened

Nine critically injured students were airlifted to the capital Nairobi for treatment, disaster management officials said.

But each student had been accounted for by the end of the evacuation.

An overnight curfew has been implemented in Garissa and three other counties in Kenya.

UN Secretary-General Ban Ki-moon condemned what he called a "terrorist attack" and said the UN was ready to help Kenya "prevent and counter terrorism and violent extremism".

The United States said it was offering Nairobi assistance to take on al-Shabab and would continue to work with others in the region to take on the group.

The Kenyan government has named Mohamed Kuno, a high-ranking al-Shabab official, as the mastermind of the attack.

Mr Kuno was headmaster at an Islamic school in Garissa before he quit in 2007.

Kenyan President Uhuru Kenyatta offered his condolences to families of the victims and ordered "urgent steps" to ensure police recruits could begin training immediately. "We have suffered unnecessarily due to shortage of security personnel," he said.

Al-Shabab says it attacked the university because it is at war with Kenya, BBC Africa analyst Mary Harper reports.

Kenyan troops entered Somalia in October 2011 in an effort to stop the Islamists from crossing the long, porous border between the two countries and kidnapping people - but their presence achieved the opposite effect, provoking al-Shabab to increase its activity in Kenya, our correspondent adds.

The group was behind the Westgate shopping mall attack, when 67 people were killed.

Source: BBC