Somalia's Islamist Hezb al-Islam militia officially joined forces with the Al Qaeda-inspired al- Shabaab movement in what they said was meant to set up an "Islamic Caliphate" in the country.
The more political Hezb al-Islam, founded in 2007 by Sheikh Hassan Dahir Aweys -- a declared terrorist by the United States -- last weekend announced its intention to merge with the al- Shabaab.
"The reason we have joined forces also includes continuing the holy war and standing against the invasion by the Christian forces and reclaim the holy territories of Muslims that were forcefully taken," said a statement released late Thursday.
Senior leaders of the two Islamist groups attended a ceremony to make the declaration in a mosque in the capital Mogadishu Thursday, but the movements' senior-most leaders were absent.
Relations between the two groups have nevertheless not been smooth and in the past year they have frequently fought for control of territory mainly in Somalia's southern regions.
The al- Shabaab last year wrested control of the key southern Kismayo port town from Hezb al-Islam after weeks of intense gun battles and later seized another strategic town south of Mogadishu from their rivals.
Last week, tensions rose between them in a town northwest of the capital where thousands of civilians fleeing the Mogadishu fighting have sought refuge.
The al- Shabaab also on Thursday took control of Harardhere, a key pirate town on Somalia's northern coast, which had been ruled by the Hezb al-Islam fighters since May.
Witnesses said hundreds of heavily armed al- Shabaab militants on pick-up trucks stormed the coastal town, forcing some of the Hezb al-Islam fighters to flee, while others decided to join them.
"They have taken positions around the police station and at several checkpoints in the town," said Mohamed Weli Adan, an elder.
A Hezb al-Islam commander confirmed the take-over.
"The al- Shabaab officially took control of Harardhere and the militiamen from Hezb al-Islam joined them, but some of my colleagues decided not join and instead fled the town," said Sheik Ali Ahmed.
The two Islamist groups have however been bound by their drive to oust the Western-backed transitional government in Mogadishu where they have hemmed the administration in a few blocs where it is protected by African Union forces.