At least 147 people have been killed and 79 wounded after al-Shabaab gunmen stormed a university in Kenya, opened fire on dormitories, released Muslim students, and took Christians hostage.

Kenya's National Disaster Operation Centre said the siege at Garissa University College ended on Thursday evening and that all students were evacuated from the building.

Interior Minister Joseph Nkaisser said security officers killed four suspected al-Shabaab attackers they had cornered in a dormitory.

Conflicting accounts of the number of fatalities emerged from the scene. Earlier, Mr Nkaisser said the death toll had risen from 16 to 70. Kenya's National Disaster Operation Centre later revised the number to 147. However, a Kenyan police source told the Press Association that as many as 160 people had died.

A dusk-to-dawn curfew running from 6.30pm to 6.30am across the four regions of Kenya which border Somalia was put into place as a precaution after the attack.

Heavy gunfire was reported in the early hours of Thursday morning at the university, which is located 120 miles from the Somalian border, when militants attacked the building.

Kenya's National Police Service said armed militants shot at campus guards to gain entry, triggering a "fierce shootout". The attackers still managed to get inside one of the student dormitories.

In pictures: Kenya Garissa University shooting Show all 10 1 /10 In pictures: Kenya Garissa University shooting In pictures: Kenya Garissa University shooting Kenya A Kenya Defense Force soldier runs for cover near the perimeter wall where attackers are holding up at a campus in Garissa Reuters In pictures: Kenya Garissa University shooting Kenya Kenyan soldiers take cover as shots are fired in front of Garissa University EPA In pictures: Kenya Garissa University shooting Kenya Students of the Garissa University College take shelter in a vehicle after fleeing from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Kenyan police officers take cover outside the Garissa University College during an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Students gather and watch from a distance outside the Garissa University College after an attack by gunmen In pictures: Kenya Garissa University shooting Kenya Students of the Garissa University College get out of a house where they were taking shelter from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Kenyan police officers take positions outside the Garissa University College as an ambulance carrying the injured going to a hospital, during an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Students get out of a house where they seek refuge after fleeing from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Some students without their shirts of the Garissa University College get out of a house where they seek refuge after escaping from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Kenya Defence Forces soldiers move behind a thicket in Garissa

A spokesman for al-Shabaab told the BBC: "We've killed many people; Kenyans will be shocked when the go inside," a few hours after the siege began.

One student who witnessed the attack said he could hear militants opening doors and asking those hiding inside if they were Muslim or Christian. "If you were a Christian you were shot on the spot," he said. "With each blast of the gun I thought I was going to die."

Paramedics help a woman who was injured during the attack (Image: Carl de Souza/AFP/Getty Images) (AFP PHOTO / CARL DE SOUZACARL DE SOUZA/AFP/Getty Images)

One student who fled described chaotic scenes as gunmen burst into the building. "They are just shooting randomly," he said.

"My life was in danger, in fact everybody's. They were shooting at us with live bullets, everywhere, all over the school compound."

The US Embassy in Nairobi condemned the shooting as a "terrorist attack" on its official Twitter feed.

One Red Cross official told the BBC the attack began at 5am local time when a grenade was launched at the university’s gates.

“The attackers went into the girl’s hostel which is when they took the hostel over," she said. "Forces responded and took over the operation and they have locked down the campus.

Kenya Defence Forces soldiers move behind a thicket in Garissa town (Reuters)

Al-Shabaab has been responsible for a string of violent attacks in Kenya over recent years, which it claims are retribution for Kenya sending troops into Somalia.

Police believe the mastermind behind the attack may be Mohammed Mohamud, a teacher at a an Islamic religious school, or madrassa, who previously claimed responsibility for a bus attack in Makka, Kenya, in November that killed 28 people, and is alleged to lead al-Shabab's cross-border raids into Kenya.

Mohamud, also known by the names Dulyadin and Gamadhere, is now being sought under a $220,000 (£148,000) bounty for him.

Additional reporting by agencies

Timeline: Al-Shabaab attacks

March 2015 Militants stormed the Maka al-Mukarramah Hotel in Somalia’s capital, Mogadishu. At least 24 people, including six attackers, were killed. The battle lasted more than 12 hours as Somalia’s security forces tried to dislodge the gunmen who had taken control of parts of the hotel.

February 2015 Twenty-five people were killed and 40 wounded in suicide attacks at the Central Hotel in Mogadishu. Government officials were meeting at the hotel at the time, and Mogadishu’s deputy mayor and two politicians were among the dead.

December 2014 Gunmen roused sleeping quarry workers in the dead of night in northern Kenya. After separating out the non-Muslims by asking them to recite the Islamic creed, the attackers killed 36 of them – most with a gunshot to the back of the head.

November 2014 Gunmen attacked a bus in northern Kenya at dawn, targeting and killing 28 passengers who could not recite the Islamic creed and were assumed to be non-Muslims.

September 2013 Militants used grenades and assault rifles to attack the Westgate shopping mall in Kenya’s capital, Nairobi, killing at least 67 people.