MOGADISHU - Somalia's president swore on Wednesday to intensify his war against insurgents blamed for a suicide bombing at a medical graduation ceremony last week that killed 22 people, including three government ministers.

Sheikh Sharif Ahmed's fragile administration controls only a few districts of Mogadishu and comes under near daily attack by rebels including the hardline al Shabaab group, which Washington says is al Qaeda's proxy in the failed Horn of African state.

Western security agencies say the country has become a safe haven for militants, including foreign jihadists, who are using it to plot attacks across the impoverished region and beyond.

A spokesman for al Shabaab denied the group was responsible for last Thursday's suicide bombing, but few Somalis believed him and the U.N. special envoy to the country said it was outrageous to suggest that anyone else was to blame.

Speaking to the commanders of his fledgling naval forces, Ahmed said the rebels had humiliated the Somali people.

We have to be ready to clear them out of the country and restore peace, Ahmed said. They have decided to kill anyone who does not subscribe to their ideology. But Somalis have realised the trouble caused by these groups.

The country has known no peace for almost two decades since the overthrow of a military dictator heralded a period of warlord fiefdoms. But even that era did not witness the bloodletting and violence that Somalis have seen in recent years.

AHMED CALLS ON NAVY

Fighting has killed at least 19,000 Somali civilians since the start of 2007 and driven 1.5 million from their homes, triggering one of the world's worst humanitarian disasters.
The chaos has also spilt offshore, where heavily armed Somali pirate gangs have made tens of millions of dollars in ransoms by terrorising commercial shipping in the Indian Ocean and strategic Gulf of Aden which links Europe to Asia.

Somalia's navy plans to join foreign militaries that are targeting the sea gangs, but is still in its infancy. Officers have to hire boats from fishermen for their military exercises.

The pirates have destroyed Somalia's reputation for small amounts of money by hijacking ships. The navy should be ready to defend ships against violent hijacking, Ahmed said.

Some pirates say they started out just planning to protect their coastline against illegal waste dumping and trawling by foreign fishing fleets. Ahmed acknowledged that illegal fishing had been going on since 1991, and said it was another problem.

At the weekend, Somalia's government called for an international peace plan like President Barack Obama's new Afghan strategy, saying it would be more effective and far cheaper than current efforts to combat piracy.

(Writing by Helen Nyambura-Mwaura; Editing by Daniel Wallis and Noah Barkin)