Gunmen attacked the campus early Thursday as morning prayers were underway, shooting indiscriminately and taking hostages before being killed by security forces, officials said.
The U.S. Embassy in Nairobi said Al-Shabaab militants have claimed responsibility.
What is Al-Shabaab, and what does it want?
Al-Shabaab is a Somali group that the United States designated as a foreign terrorist organization in March 2008. It wants to turn Somalia into a fundamentalist Islamic state, according to the Council on Foreign Relations.
The group has been blamed for attacks in Somalia that have killed international aid workers, journalists, civilian leaders and African Union peacekeepers.
It has a history of striking abroad, too. Before admitting to the Kenya quarry attack, Al-Shabaab claimed responsibility for the July 2010 suicide bombings in Kampala, Uganda, that killed more than 70 people, including a U.S. citizen, who had gathered at different locations to watch the broadcast of the World Cup final soccer match.
How big is it?
The total size of Al-Shabaab is not clear.
In 2011, a U.S. official who declined to be identified because of the sensitivity of the information said the group was estimated to control up to 1,000 fighters.
A United Nations report identified one insurgent leader who is believed to command "an estimated force of between 200 and 500 fighters," most of them Kenyans.
And Al-Shabaab has links to other organizations. In February 2012, the group's leader, Ahmed Abdi Godane, and al Qaeda leader Ayman al-Zawahiri released a video announcing the alliance of the two organizations.
How did Al-Shabaab start?
Decades of weak government amid grinding poverty have long made Somalia a target for radical Islamist groups.
Al-Shabaab's predecessor was al-Ittihad al-Islami (AIAI), which worked to create an Islamist emirate in Somalia. It was partially funded by former al Qaeda leader Osama bin Laden, according to the Council on Foreign Relations.
AIAI, which the U.S. State Department designated as a terrorist group, strengthened after the fall in 1991 of Siad Barre's military regime and during the years of lawlessness that ensued.
In 2003, a rift erupted between AIAI's old guard -- which was seeking to establish a new political front -- and its younger members, who wanted to impose fundamental Islamic rule. (Al-Shabaab means "the youth.")
That strife led the younger members to ally with a group of Sharia courts -- the Islamic Courts Union (ICU) -- that was seeking to impose order over a landscape marked by feuding warlords in the capital city.
Working together, the Islamic Courts Union and Al-Shabaab gained control of Mogadishu in 2006. That sparked fears in neighboring Ethiopia that violence would spill over there, according to the Council on Foreign Relations.
Those fears -- combined with a request from Somalia's transitional government -- led Ethiopian forces to enter Somalia in December 2006 to remove the ICU from power.
And that move inflamed Al-Shabaab, which then attacked Ethiopian forces and gained control of parts of central and southern Somalia, according to a 2011 case study by Rob Wise, who was then with the Counterterrorism Program at the Center for Strategic and International Studies.
What is Al-Shabaab's relationship with neighboring countries?
In 2011, after attacks on tourist destinations in northern Kenya blamed on Al-Shabaab, the Kenyan government ordered a cross-border incursion aimed at creating a security buffer zone in southern Somalia.
Ethiopian troops have also crossed the border and expelled Al-Shabaab from Baidoa, a strategic town midway between the Ethiopian border and Mogadishu.
The group then targeted African Union soldiers and government buildings in the capital in suicide attacks. A suicide bombing in March 2012 killed five people at the presidential palace.
Analysts say tension appears to have been growing within Al-Shabaab between Somalis and foreign fighters, several hundred of whom are thought to have entered Somalia in recent years to join the group.
How does Al-Shabaab recruit?
The group has a sophisticated public relations arm that includes a Twitter account and video production abilities.
Al-Shabaab has even made a video that's as slickly produced as a reality TV show, complete with a hip-hop jihad voice and a startling message:
"Mortar by mortar, shell by shell, only going to stop when I send them to hell," an unidentified voice raps in English.
But Al-Shabaab's enemies -- and alliances -- can shift.
Abu Mansour al-Amriki, a former Al-Shabaab fighter and prolific English-language propagandist for the group, said in a video posted online last year that he had had a fallout with Al-Shabaab "regarding matters of the Sharia and matters of strategy" and feared for his life.
Al-Amriki, whose real name is Omar Hammami, was reportedly killed in Somalia by Al-Shabaab. CNN was not able to confirm the report.
Finding replacements might not be difficult.
Sheikh Ahmed Matan, a member of Britain's Somali community, said he knows of hundreds of young Somali men living in the West who returned to Somalia for terrorist training.
Al-Shabaab has also "succeeded in recruiting a number of Americans to fight in Somalia, most of whom are from Minnesota," CNN national security analyst Peter Bergen wrote in a CNN.com column.
In 2008, the FBI launched Operation Rhino, "a serious effort to crack down on anyone traveling to Somalia to support Al-Shabaab," Bergen wrote.
How is Al-Shabaab funded?
The once-ragtag al Qaeda affiliate has grown into an economic powerhouse, raising tens of millions of dollars in cash from schemes that have involved extortion, illegal taxation and other "fees," according to the 2011 United Nations report.
The United States believed then that the group was coordinating with al Qaeda groups in Yemen and might have been plotting attacks in the region and abroad.
In 2011, it was generating "between $70 million and $100 million per year, from duties and fees levied at airports and seaports, taxes on goods and services, taxes in kind on domestic produce, 'jihad contributions,' checkpoints and various forms of extortion justified in terms of religious obligation," according to the report from the U.N. Monitoring Group on Somalia and Eritrea.
How have Somalis been affected?
In 2011, the U.N. declared a famine in the southern Somalia regions of Bakool and Lower Shabelle, and Al-Shabaab reversed an earlier pledge to allow aid agencies to provide food in famine-stricken areas.
That year, the U.N. Interagency Group for Child Mortality Estimation said Somalia had the highest mortality rate in the world for children ages 4 and younger.
About 258,000 Somalis died in the famine between October 2010 and April 2012, and half the victims were younger than 5 years old, according to a report from the U.N. Food and Agriculture Organization and the USAID-funded Famine Early Warning Systems Network.
What is the United States doing?
The United States has supported U.N.-backed African forces fighting Al-Shabaab and strengthened its counterterrorism efforts against the group.
It has also donated millions of dollars in aid.
What is the status of Somalia's government today?
In September 2012, Somali parliament members selected Hassan Sheikh Mohamud as the new president in a vote that marked a milestone for the nation, which had not had a stable central government since Barre's overthrow 21 years earlier.
But that didn't mean Al-Shabaab was calling it quits. In January 2013, French forces attempted to rescue a French intelligence commando held hostage in Somalia by the group. The raid left the soldier dead, another soldier missing and 17 Islamist fighters dead.
But there has been political progress in Somalia.
In January 2013, for the first time in more than two decades, the United States granted official recognition
to the Somali government.