Just hours after Islamist fighters abandoned Mogadishu , the capital from which they ruled much of Somalia , thousands of troops of the transitional government marched into the city on Thursday in a stunning reversal of fortune .