The two sides met on Monday in the Sudanese capital, Khartoum, for Arab League-mediated talks, and agreed to "build armed forces like an army and police, including forces from the Islamic courts, the government and other militias in the country".
Details of how this would be done were to be agreed by the two sides after a political solution was reached, a statement said.
Late on the third day of talks, the fragile interim government and representatives of the Islamic Courts Group (ICG) which now controls large swathes of the country, agreed to reconvene on October 30 for power-sharing talks on political and security issues.
Aljazeera's correspondent in Khartoum said that agreement had also been reached on the possible withdrawal of Ethiopian troops from the country, whose presence had caused friction between the two nations.
Both sides also called for international support in rebuilding the country, shattered from more than a decade of civil war, our correspondent said.
Meanwhile, 10 people were killed in fighting between police and militia fighters in Baidoa, the current seat of the national government.
Several other people were wounded in the clashes that police say were unrelated to the peace talks being held in Khartoum.
Police say they moved to evict fighters who had set up at Baidoa's airport after having been dismissed as airport security workers.
Ali Mohamed Gedi, the prime minister, said he and his government regretted the incident, but said it had been necessary to ensure safety at the airport.
He said: "The government has plans to set up a camp at the airport, which the militiamen had occupied.
"We want policemen to take control of the airport."
Earlier, police and witnesses said 12 people - seven fighters and five government security forces - had been killed in the incident.