Earlier last year the Islamists took control of the capital Mogadishu and much of the country and were closing in on the weak transitional government's last stronghold at Baidoa.