Hassan Dahir Aweys is one of two leaders of the Union of Islamic Courts
A top Somali Islamist leader has rejected a UN-brokered, three-month ceasefire deal signed by Somalia's government and an opposition bloc.
Sheikh Hassan Dahir Aweys promised to continue fighting until all foreign troops left the country.
The deal was signed by another top Islamist leader, Sheikh Sharif Sheikh Ahmed, and Prime Minister Nur Adde.
Aimed at ending years of conflict, it provides for Ethiopian troops leaving Somalia within 120 days.
Mr Aweys, the founder of the Union of Islamic Courts (UIC) that ruled much of Somalia in 2006 before being ousted by Ethiopian forces backed by Somali government troops, is a member of the opposition alliance based in Eritrea.
He is seen as the more hardline leader of the courts and has never supported the peace talks.
"We shall continue fighting until we liberate our country from the enemies of Allah," he told Mogadishu-based Shabelle radio.
Al-Shabab, the UIC's youth wing whose fighters have been behind much of the violence against the Ethiopian and Somali government troops, has also distanced itself from the talks.
UN envoy to Somalia Ahmedou Ould Abdallah said the government and the Alliance for the Re-Liberation of Somalia had agreed at talks in neighbouring Djibouti to cease hostilities in 30 days time for three months.
The BBC's Mohammed Olad Hassan in Mogadishu says news of the deal came as a surprise as on Monday night the talks seemed on the verge of collapse.
Many people displaced by the fighting have been calling radio stations to express their relief, he says.
But there is also much scepticism about how the deal will be implemented.
The deal brokered at UN-led talks in Djibouti does not include many of the armed Somali groups at present fighting the transitional government and the Ethiopian troops backing it.
Correspondents say it is not clear if it will have any impact on the clashes which are still killing dozens of people every week.
At least 28 people were killed during clashes between Islamist insurgents and Ethiopian troops backing the Somali government over the weekend.
On Saturday, BBC Somali service reporter Nasteh Dahir was killed by suspected Islamist militants in the southern port of Kismayo.
Even so, Abdulrahman Warsame, who negotiated the deal for the opposition alliance, was optimistic.
"I think everyone from Somalia, including Aweys, wants (the) Ethiopians to leave Somalia, and Somalis (to) talk and engage peaceful means," he told the BBC.
"And I think if we achieve that I think everyone will support finally, even if they are rejecting now."
The talks in Djibouti were the latest attempt to negotiate an end to the anarchy in Somalia.
Mr Ould Abdallah told the BBC the deal was reached after the two parties held their first face-to-face talks.
Somali forces have been struggling to contain the violence
"It took eight days to attend workshops, to live in the same hotel, but avoiding each other. Finally they met... Confidence resumed slowly, and we have to support and nurture that renewed confidence," he said.
"The cessation of armed confrontations shall come into force 30 days from the signing of this agreement throughout the national territory," the text of the deal said.
The agreement covers an initial period of 90 days, after which it is up for renewal.
It also envisages that Ethiopian troops will withdraw from Somalia within 120 days, once a UN peacekeeping force is deployed.
There is not yet any official agreement for a UN peacekeeping mission to be sent.
Abdi Samatar, a Somali scholar at the University of Minnesota, told the BBC's Network Africa programme that for the agreement to succeed, the UN will have to play a central role in getting Ethiopia to withdraw and making sure the signatories stick to the deal.
Some 2,200 African Union troops are in Mogadishu, but have done little to quell the violence which has triggered a humanitarian crisis that aid workers say may be the worst in Africa.
It is estimated that the conflict has created more than one million refugees.
Somalia has experienced almost constant civil conflict since the collapse of Mohamed Siad Barre's regime in January 1991.
Are you in Somalia? Are you affected by the issues in this story? Send us your comments using the form below.
The BBC may edit your comments and not all emails will be published. Your comments may be published on any BBC media worldwide.