The death toll from a deadly attack on a hotel in Mogadishu rose to 27 on Sunday, prompting the Somali government to sack its police and intelligence chiefs.