Both countries are emerging from bloody civil wars that ruined much of their infrastructure .