Pakistani lawmakers elected former cricket legend Imran Khan prime minister on Friday and he pledged to bring to justice “all those who have robbed this country” through corruption.