Somalia's Islamist militant group al-Shabab, accused of having links to al-Qaeda, has claimed responsibility for a suicide bombing in the capital.
The group's political leader Sheik Husein Ali Fidow said a Somali teenager had carried out Sunday's attack, which killed six soldiers and a civilian.
Meanwhile, Somalia's president has asked for international help to stop foreigners fighting with the militants.
Some 60,000 people have fled the recent upsurge of fighting in Mogadishu.
President Sheikh Sharif Sheikh Ahmed, a moderate Islamist elected by a unity government in January as part of a UN-backed peace initiative, said a government offensive against the insurgents would continue.
Very little is being done by the international agencies because of the fragile security situation
About 200 people are thought to have been killed since the beginning of May, as Islamist insurgents try to topple the fragile interim government.
The UN refugee agency's Roberta Russo said an estimated 8,000 were displaced on Friday alone when the government offensive began.
"Some of the people had only recently returned to Mogadishu because of the relative peace since the beginning of the year," she told the BBC's Network Africa programme.
Mr Ahmed, whose introduction of Sharia law has not appeased the Islamist insurgents, said mediation by clerics had failed and his government had no choice but to fight on.
Al-Shabab denied claims that the suicide car bomber, who drove a pick-up truck to the gates of a police training school, was a foreigner, but has admitted it had "Muslim brothers" from other countries fighting in its ranks.
Mr Fidow warned that such attacks against government and African Union (AU) targets would continue in the weeks and months ahead.
Hardline Islamist groups want to impose a stricter version of Islamic law and they want AU peacekeepers to leave Somalia.
President Ahmed told reporters in the capital: "The world should help us get rid of the foreigners who are fighting against the Somali government."
He said some of the foreigners had fought in Iraq and Afghanistan.
BBC East Africa correspondent Will Ross says suicide bomb attacks are relatively rare in Somalia.
The last was in February, when two suicide bombers attacked an AU military base killing at least 11 Burundian soldiers.
The AU is not involved in the fighting as the 4,300-strong force does not have a mandate to pursue the insurgents.
The UNHCR says many of those fleeing the city are women and children.
"Very often their husbands have been killed and they are leaving Mogadishu with very little," Ms Russo said.
"Those going to Afgoye, 30km (18 miles) south-west from Mogadishu, are asking the 400,000 internally displaced people already there to share the little they have.
"Very little is being done by the international agencies because of the fragile security situation."
The BBC's Mohammed Olad Hassan in Mogadishu says local non-governmental organisations are trying to distribute water to some of the displaced, who are living out in the open under trees.
Mogadishu has been blighted by 18 years of almost uninterrupted civil unrest.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.