Somali fighters have captured a strategically important town near the capital, Mogadishu.
Witnesses said there were two hours of heavy fighting on Sunday before members of the al-Shabab group took Jowhar.
The clashes 90km north of Mogadishu come as human rights workers say at least 68 people have been killed in fighting in the capital during the past 48 hours.
Al Jazeera's Mohammed Adow, reporting from neighbouring Djibouti, said: "We can confirm the town of Jowhar has been captured by al-Shabab.
"In essence, the capture of Jowhar which was one of the last strongholds of the president, means the government is quickly losing ground in the battle for Somalia and it is also virtually surrounded by al-Shabab militias who have been strengthening and consolidating their hold.
"There have been many people who had been returning to the capital and now they are being forced to go back to where they came from."
One resident told the Reuters news agency that there had been "serious fighting" in Jowhar in which at least seven people had been killed.
Farhan Mohamoud, the Somali information minister, told Al Jazeera that he hoped the local community in Jowhar would fight back against "the invaders".
"There have been a lot of skirmishes in central Somalia ... and there have been a lot of uprisings against al-Shabab, the communities everywhere are organising themselves to defend [themselves].
But, Ali Moalim Hassan, a town elder, told the AFP news agency that control of the town had been effectively ceded to al-Shabab after "the other Islamist militia backing the government deserted their positions".
Al-Shabab is said to have attacked Jowhar on two fronts early in the morning and took over the prison and released detainees.
"Three civilians died and seven were injured after mortars targeting the police headquarters hit civilians," Abdulahi Mohamed Jis, a witness told AFP.
The government is thought to be attempting to bring in reinforcements to retake the area and contain the opposition fighters.
Jowhar is the home town of Sharif Ahmed, the president, and in 2005 it was chosen as the temporary location for the country's transitional government.
The Somali government has been losing ground in recent weeks and now controls little more than the centre of the capital, with the support of African Union troops.
On May 15, Somalia's president appealed to al-Shabab to negotiate as sporadic fighting continued in Mogadishu.
"[The council expresses] concern at the loss of life and the worsening humanitarian situation arising out of the renewed fighting"
UN security council
More than 100 people were killed and at least 30,000 displaced in the clashes that started on May 7.
The government control part of Mogadishu and the border town of El Berde, while allied militias control areas in central Somalia.
However, al-Shabab, which has vowed to topple Ahmed, controls much of the south of the country.
The UN Security Council has voiced concern about reported arms supplies to al-Shabab by neighbouring Eritrea.
Eritrea rejects the accusations that it sends weapons to the al Qaeda-linked groups fighting Somalia's government.
The council expressed "concern at the loss of life and the worsening humanitarian situation arising out of the renewed fighting".
Somalia has not had an effective government since 1991, when Mohamed Siad Barre was overthrown by armed groups who then turned on each other.