The fighting was sparked by a territorial dispute between gunmen loyal to Mogadishu 's Islamic courts and fighters allied with local warlords .