The massacre that killed 147 people and wounded scores of others at a Kenyan university lasted for hours Thursday before the terror was over.

“It is a very sad day for Kenya,” Interior Ministry Joseph Nkaissery said of the carnage at Garissa University College.

The death toll is the highest in a terror attack on Kenyan soil since the U.S. Embassy was bombed in 1998. More than 200 people died in the Nairobi blast.

A total of 147 people were killed Thursday, according to the official Twitter account of Kenya’s National Disaster Operation Centre and Kenyan media reports. The agency also said 79 people were injured and 587 people were evacuated.

Four gunmen were killed, officials said.

The Somalia-based Al-Shabaab militant group claimed responsibility for the assault.

Islamist gunmen burst into the university before dawn Thursday, shooting students and taking hostages during early morning prayer services.

At one point, the attackers cornered a building in which 360 students live, but some of the students escaped, Nkaissery said.

Kenyan forces cleared three of four dormitories and had cornered the militants in the last one, the Interior Ministry explained.

“This is a moment for everyone throughout the country to be vigilant as we continue to confront and defeat our enemies,” Kenyan President Uhuru Kenyatta said.

There are usually four guards at the campus gates overnight, Jackstone Kweyu, dean of students, told Kenya’s Citizen TV.

The attack was deadlier than an Al-Shabaab attack on the Westgate shopping center in Nairobi in September 2013 that left 67 people dead.

Joel Ayora, who was on the campus and witnessed the attack, said gunmen burst into a Christian service. Taking hostages from the service, they then “proceeded to the hostels, shooting anybody they came across except their fellows, the Muslims.”

The attackers separated students by religion, allowing Muslims to leave and keeping an unknown number of Christians hostage, Agence France-Presse reported.

“We were sleeping when we heard a loud explosion that was followed by gunshots and everyone started running for safety,” student Japhet Mwala told AFP.

“There are those who were not able to leave the hostels where the gunmen headed and started firing. I am lucky to be alive because I jumped through the fence with other students.”

For hours after the attack began, heavy gunfire and explosions continued, said Dennis Okari of CNN affiliate NTV.

kenya shooting