Kenyan President Uhuru Kenyatta has vowed to respond "in the severest ways possible" to the al-Shabab militant attack on Garissa university in which 148 people died.
In an address to the nation, Mr Kenyatta said the Islamist group posed an "existential threat" to Kenya.
He also said the government would take steps to crack down on those who planned and financed terrorist attacks.
Mr Kenyatta also declared three days of mourning for the victims. Almost all the dead were students. Another people 79 were injured.
Four militant gunmen were killed, and officials say they are holding five people for questioning - one of whom is believed to be a university security guard.
Buses are transporting more than 600 students and about 50 staff who survived the attacks to their home areas, Garissa governor Nathif Jama Adam told Reuters news agency.
Mr Kenyatta vowed to "fight terrorism to the end" and said the militants would not succeed in their aim of creating an Islamic caliphate in Kenya.
"I want you to know that our security forces are pursuing the remaining accomplices. We will bring all of them to justice," he said.
"Our forefathers bled and died for this nation, and we will do everything to defend our way of life."
He called on political and religious leaders to "speak in a united voice" and give "weightiest consideration" to national security.
The task of combating terrorism had been complicated by the fact that "the planners and financiers of this brutality are deeply embedded in our communities", Mr Kenyatta added.
"We will not allow them to continue their lives as normal," he said.
The president's address came as the relatives of victims queued at a morgue in the capital Nairobi to identify their loved ones.
The bodies were flown to Nairobi for identification, as local mortuaries have been unable to cope, and many of the students killed came from other parts of the country.
The bodies of the four gunmen who died remain in Garissa, where they were put on public display on Saturday.
Earlier on Saturday, a 19-year-old girl was found unhurt in a cupboard on the university campus, where she had hid for two days.
Security officials had to bring in a teacher to convince her that it was safe to come out. She told reporters that she drank body lotion when she felt hungry.
While many of the survivors have spoken to the media, little is known so far about those who were killed.
There has been criticism in Garissa, which is 150km (100 miles) from the Somali border, at how the security services dealt with the attack.
Only two guards were on duty at the time of the assault, despite official warnings that an attack on an institution of higher learning was likely.
Al-Shabab, which is based in neighbouring Somalia, has pledged a "long, gruesome war" against Kenya.
The group said its attacks were in retaliation for acts by Kenya's security forces, who are part of the African Union's mission in Somalia against al-Shabab.