A former warlord who has long lived by his gun was sworn in as mayor of Mogadishu on Friday and immediately ordered residents of the Somali capital to get rid of their weapons.

But Mayor Mohamed Dheere offered no clear details on how that could be accomplished in a city awash in Kalashnikov rifles, machine guns and hand grenades. Previous efforts to get residents to give up their weapons have been unsuccessful.

"No weapons are allowed in the city," Dheere, who spent 16 years as a warlord struggling for power in this Horn of Africa nation, said at his inauguration ceremony. "Anyone who violates this directive will be punished."

The new police chief, Abdi Qeybdiid, also called for residents to disarm Friday, and said cars with blacked-out or tinted windows must go.

"Anyone who fails to abide by these rules will be brought before the court," he said — a surprising assertion in a city that has seen little more than chaos for more than a decade.

Dheere is trying to build on a fragile peace carved out by clan deal-making and a fierce military crackdown on Muslim militants.

Aid groups say 1,670 people were killed between March 12 and April 26 and more than 340,000 of the city's 2 million residents fled for safety as the government, backed by Ethiopian troops, pressed to wipe out an Islamic insurgency.

It was not clear how long the calm would last — extremist Islamic leaders have vowed their forces would rise up again. But the violence was also spurred by a struggle for power among Somali clans, and that element may have subsided because of efforts to appease the clans, including the weekend appointment of Dheere as mayor. Dheere's powerful clan, the Hawiye, had complained of being ignored by the government.

Somalia has been mired in chaos since 1991, when warlords overthrew dictator Mohamed Siad Barre and then turned against each other. The current government was established in 2004, but has failed to assert full control.

With the crucial aid of troops from neighboring Ethiopia, Somali forces ousted a militant Islamic group known as the Council of Islamic Courts over the New Year. But the group promised to launch an Iraq-style insurgency, and the capital was soon enduring weeks of artillery battles and shelling between the warring sides.

The relentless violence is among the reasons many Somalis have been reluctant to give up their arms. But in a hopeful sign for the government, several members of the powerful business community in the capital handed over 25 boxes and 20 sacks filled with weapons, saying they would now depend on government forces to protect them.

But violence and crime continues to be a challenge. On Thursday, gunmen seized three boats off the coast of Somalia's semiautonomous Puntland region, said Andrew Mwangura, head of the Kenyan chapter of the Seafarers Assistance Program. Mwangura had no update on the situation Friday.