Updated

Somalia's new leader was inaugurated Sunday amid tight security in the capital, Mogadishu, four days after President Hassan Skeikh Mohamud survived an assassination attempt.

Mohamud, a teacher and activist, won the election last week against outgoing President Sheik Sharif Sheikh Ahmed by the legislative vote of 190 to 79.

The inauguration ceremony was attended by some regional leaders, including the prime minister of Ethiopia and the president of Djibouti.

The attempt on Mohamud's life on his second day in office highlighted the serious security challenges he faces as he takes the helm of a volatile country that has not had a stable government for more than two decades. Mohamud himself acknowledged this fact, saying in his inauguration remarks that security was the paramount issue. He promised to be a democrat and to create "an effective justice system" that serves all Somalis.

"I promise (that) my government will deliver a new democratic beginning," he told a congregation at the Police Academy, the same venue where he was elected.

His predecessor, Ahmed, said in his remarks that he was happy that a degree of security had returned to Mogadishu. He wished Mohamud success.

The U.N.-backed political process that resulted in Mohamud's election was condemned by Islamist militants who said it was manipulated by the West. But Mohamud has the support of the international community, which wants him to succeed and bring stability to the troubled Horn of Africa nation.

Augustine Mahiga, the top U.N. representative to Somalia, said the inauguration of Mohamud was a watershed moment for Somalia.

"This marks the end of the transitional period and the beginning of a new era for Somalia," Mahiga said in a statement. "The change that was envisioned ... has arrived. The process was transparent, representative and Somali-owned and led."

Somalia has seen much progress over the last year. Al-Shabab militants were forced out of Mogadishu in August 2011, allowing businesses to thrive and the arts and sports to return. The militants have either fled to northern Somalia and Yemen, or have retreated to Kismayo, the last major town they control. But occasionally they succeed in breaching security to stage terrorist attacks in Mogadishu such as the assassination attempt on Wednesday by suicide bombers who tried to infiltrate a hotel where the president was addressing reporters.

Mohamud faces an uphill task unifying a fractious country in the face of the al-Qaida-linked Islamist insurgency and rebuilding a bombed-out infrastructure, food security and institutions.

Another challenge is fighting endemic corruption that plagued previous governments. While Somalia has had transitional administrations since 2004, it has not had a functioning central government since 1991, when warlords overthrew a longtime dictator and turned on each other, plunging the impoverished nation into chaos.

Last month Somali leaders endorsed a new provisional constitution that expands rights for Somali citizens. The U.N. hopes that one day all of Somalia will be able to vote to endorse or reject the constitution.