In December 2006, the ENDF entered Somalia to confront the Islamic Courts Union, initially winning the Battle of Baidoa. This led to the seizure of Mogadishu by Ethiopian troops and TFG militias, and subsequent heavy fighting there. After the Islamists split into two groups, moderate Islamists led by Sharif Sheikh Ahmed signed a UN backed peace deal with the TFG and established a larger government in Mogadishu. Ethiopian troops withdrew as part of the terms of the peace deal. Gabre Heard commanded the forces in Somalia.