* Mohamud voted in by members of parliament
* President calls for end to conflict and piracy
By Abdi Sheikh and Mohamed Ahmed
MOGADISHU, Sept 16 (Reuters) - Somalia's new president Hassan Sheikh Mohamud took office on Sunday, calling for an end to terrorism and piracy in a nation mired in conflict for more than two decades.
Mohamud's inauguration, the first of its kind since the country slid into civil war after warlords toppled dictator Mohamed Siad Barre in 1991, follows a regionally-brokered, UN-backed effort to end fighting in which tens of thousands of people were killed and many more fled.
Mohamud is a relatively new face in Somali politics, but the one-time academic will have to encounter old problems: acrimonious clan politics, rampant corruption, maritime piracy and a stubborn insurgency by al Shabaab Islamist rebels.
"We want Somalia free from piracy, terrorism and asylum seekers abroad. We want to create a united community so that Somalis and the neighbouring countries can live peacefully," Mohamud said during his inauguration at a ceremony in a fortified hall in Mogadishu's police training camp.
"Somalia has now turned a fresh page."
Islamist suicide bombers attacked the hotel where Mohamud and the visiting Kenyan foreign minister were addressing a news conference on Wednesday. They were unhurt.
Mohamud's inauguration ends a succession of United Nations-backed transitional governments since 2004.
He takes over from Sheikh Sharif Ahmed, who took over as head of a transitional government in 2009 but was defeated in this week's vote among members of parliament to appoint a new leader.
"I urge all Somalis to work cordially with the Somali president, his government and the parliament," the outgoing president said during the ceremony.
An African Union (AU) force comprising Ugandan, Djiboutian, Kenyan and Burundian soldiers is fighting al Shabaab in various parts of the country and is planning an onslaught on Kismayu, Somalia's second biggest city, which is a base for the group linked to al Qaeda.
Weakened by internal divisions and financial constraints, al Shabaab still control swathes of southern and central Somalia, while pirates, regional administrations and local militias also vie for control of parts of the Horn of Africa country.
During the inauguration, AU and government forces blocked key city roads and the only planes allowed to land or take off were those carrying dignitaries attending the ceremony.
Among those in attendance were Djibouti's President Ismail Omar Guelleh, Ethiopia's incoming Prime Minister Hailemariam Desalegn, AU Chairman Jean Ping, UN Special Envoy for Somalia Augustine Mahiga and other officials from the AU, UN and Arab League.
"Meles Zenawi, our late great leader, always worked very hard to stabilise Somalia. I wish he were with us today to witness the fruits of his labour - stabilization and democracy," Hailemariam said during the ceremony, his first international assignment after being approved to take up the post of prime minister on Saturday. (Editing by George Obulutsa and Andrew Roche)