Hadi al-Ameri, head of a leading Iraqi Shia miltia, has withdrawn his candidacy for the post of prime mininster, easing the political crisis in Iraq.