The Somali government on Friday blamed Al Qaeda-linked Islamic militants for a homicide bombing that killed 22 people in the capital, as government officials buried three Cabinet ministers killed in the attack.

The bombing Thursday ripped through a university graduation ceremony at an upscale hotel in Mogadishu, killing medical students, doctors, journalists and three government ministers.

Somalia's most powerful Islamic militant group said it was not responsible for the attack, but government officials said al-Shabab denied responsibility only because so many Somalis had been angered by the bombing.

"The investigation is still under way to uncover evidence of who might have been behind the attack, but we already know that this is the work of Al Qaeda through its affiliated group al-Shabab, because of the nature of the attack and the tactics used," said Security Minister Abdullahi Muhammad Ali.

Al-Shabab spokesman Sheik Ali Mohamud Rage said his group had nothing to do with it and that "we are very sad about it." He blamed the government for the bombing, an accusation vehemently denied by Somali officials.

"Mogadishu residents are angry and al-Shabab doesn't want to earn the wrath of the angry population. The people here are on the verge of revolt against them," Somali Information Minister Dahir Mohamud Gelle said, explaining al-Shabab's denial.

Gelle said that no Somali had ever become a homicide bomber to avenge a clan dispute, but that many times homicide bombings had been carried out "because of twisted religious beliefs."

Al-Shabab has claimed responsibility for past homicide attacks in Somalia, and has never denied carrying out an attack. But militant groups tend to distance themselves from bombings that kill large numbers of civilians — attacks that could draw popular outrage.

The government buried the three Cabinet ministers killed in the blast, holding a ceremony at a Mogadishu hospital heavily guarded by government forces and African Union peacekeepers fearful that militants might try to attack the proceedings. The president and prime minister of the weak, U.N.-backed government attended.

Caskets for the ministers of education, higher education and health were covered by the national flag.

"This is not Somali work. It is a newly imported idea to destroy Somalia and prevent its people from having stability, peace and their own government," said Somali President Sheik Sharif Sheik Ahmed. "We are committed to making the dreams of our people a reality, and such terrorist acts will never deter us."

The bombing of a graduation ceremony for medical students and other graduates in a country that needs as many doctors as it can get drew swift condemnation from around the world.

Islamic militants in Somalia have shown a rising ability to carry out sophisticated large-scale bombings against high-profile targets. The bombing also highlighted the inability of Somalia's weak government to protect even the small section of the capital it controls.

African troops protecting the weak Somali government wage near daily battles with Islamic militants who hold much of central and southern Somalia. The government holds only a few square blocks in Mogadishu, though that didn't prevent Thursday's homicide bomber from gaining entry into the ceremony.

Several hundred people had gathered in the Shamo Hotel to watch the 43 medical, engineering and computer science students from Benadir University receive their diplomas when the blast ripped through the festively decorated ballroom.

The bomber disguised himself as a woman, complete with a veil and a female's shoes. Amateur video of the attack obtained by AP Television News showed the dead, including at least three journalists, lying in pools of blood amid the sound of wails and screams from the wounded.

A statement issued by the U.S., U.N., European Union, African Union and the Arab League also condemned the attack.

Somalia has been ravaged by violence since warlords overthrew dictator Mohamed Siad Barre in 1991, then turned on each other. A moderate Islamist was elected president in January amid hopes he could unite the country's feuding factions, but the violence has continued.

Homicide bombings, unheard of in Somalia before 2007, have become increasingly frequent and the lawlessness has raised concerns that Al Qaeda is trying to gain a foothold in the Horn of Africa. The anarchy also has allowed piracy to flourish off the country's coast.