It ends months of speculation over who would land what is arguably the country’s most powerful job.