Moderate Islamist Sheikh Sharif Ahmed agreed to a truce with militants
Somalia's President Sharif Sheikh Ahmed has agreed to a truce and the introduction of Sharia law to try to defuse clashes with tribal leaders.
The deal came after talks between the Somali government and its clan opponents, and mediation by regional religious leaders.
The government has been in clashes with the Islamist group al-Shabaab, which has links to al-Qaeda.
Sheikh Sharif, a former moderate rebel leader, was elected only last month.
The agreement has yet to be passed by Somalia's parliament, but the president said there was no problem from the government's side if people wanted to be governed by Sharia law.
"The mediators asked me to introduce Islamic Sharia in the country and I agreed," Sheikh Sharif told reporters.
The truce comes after militants fought government and African Union forces in clashes which killed at least 30 people in the last few days.
Al-Shabaab recently seized the town of Baidoa, which had been the seat of the Somali parliament.
The Islamist militia has declared Sharia law in the town, and parliament now works from neighbouring Djibouti.
Some 16,000 civilians have been killed in the recent conflict and a million more have been forced from their homes.
The Horn of Africa country has not had an effective central government since 1991.