A suicide bomber disguised as a woman has killed at least 19 people, including four government ministers, in the Somali capital Mogadishu.
Officials say the attack hit a hotel in the city during a crowded graduation ceremony for medical students from a local university.
Witnesses said the attack appeared to have targeted government officials.
Islamists are fighting the UN-backed government, which only controls small pockets of territory in the country.
AT THE SCENE
Mohammed Olad Hassan BBC News, Mogadishu
The hall had been brightly decorated, and there was a feeling of excitement - such ceremonies rarely happen in Mogadishu.
Ministers and various dignitaries were sat at the front of the hall, and everyone else was sitting facing them. Journalists were right at the front.
Then all this brightness turned to darkness. All I remember is being covered in dust. Everyone was covered in dust.
I looked across and the young guy sitting next to me was dead. I had to jump over him to get out.
It was a shocking, terrible scene. There was blood splattered everywhere. I was really in disbelief, in shock. It's still impossible to understand how everything turned from colourful celebration to horror so quickly.
Somalia's President Sheikh Sharif Sheikh Ahmad described the attack as a national disaster.
Information Minister Dahir Mohamud Gelle said the male bomber had been dressed in women's clothing, "complete with a veil and a female's shoes".
The BBC's Mohammed Olad Hassan, who was at the scene, said there was a huge explosion in the hotel's meeting hall where hundreds of people were gathered for the graduation.
Five government ministers were reported to have been in the hotel at the time.
Health Minister Qamar Aden Ali, Education Minister Ahmed Abdulahi Waayeel, Higher Education Minister Ibrahim Hassan Addow and Sports Minister Saleban Olad Roble were all killed, officials said.
A security official told the AFP news agency most of the dead were believed to be students. At least two journalists were also among the dead.
"A lot of my friends were killed," medical student Mohamed Abdulqadir told Reuters.
"I was sitting next to a lecturer who also died. He had been speaking to the gathering just a few minutes before the explosion."
Health Minister Qamar Aden Ali was one of three ministers reported killed
A photographer for AFP described hearing a huge explosion and the room filling with smoke.
"I went to get my camera, and that's when I saw the bodies of the three ministers," said Mohamed Dahir.
More than 60 people were injured in the explosion.
The students were graduating from Benadir University, which was set up in 2002 to train doctors to replace those who had fled overseas or been killed in the civil war. They were only the second class to complete their training.
The Shamo hotel is often used by the few foreigners - aid workers, journalists and diplomats - who still visit Mogadishu.
It is in one of the small parts of the city controlled by the government, just 1km (0.62 miles) from the K4 junction, where the African Union peacekeeping force in Somalia, Amisom, has a base.
The BBC's East Africa correspondent, Will Ross, says the latest attack shows that even that area is unsafe.
Security was said to have been light inside the ceremony, with the ministers' bodyguards all waiting outside the meeting hall.
No-one has yet claimed responsibility for the attack, which was condemned as "inhumane and cowardly" by the African Union.
The AU said the blast would "not deter the resolve and determination of the African Union to support the people of Somalia in their quest for peace and reconciliation".
The acting head of Amisom, Wafula Wamunyini, said the blast was "intended to intimidate and blackmail" the UN-backed government.
"We want to ensure everyone we are going to continue with our mission. We are going to continue providing our services," he told AFP.
EU foreign policy chief Baroness Ashton said in a statement: "I condemn in the strongest possible terms this cowardly attack against civilians including students, doctors and journalists."
A statement signed by the United Nations, the US, the EU and the Arab League said the attack would not deter the international community from continuing its support to the Somali government.
Somalia has not had a functioning national government since 1991.
Pro-government troops regularly come under attack from the al-Shabab militant group, which is suspected of having links to al-Qaeda.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.