Pakistani lawmakers have voted to elect former cricket star and longtime politician Imran Khan as the country's next prime minister.
In the vote at the National Assembly Khan secured 176 votes, defeating opposition candidate Shahbaz Sharif of the Pakistan Muslim League-Nawaz (PML-N) party, who got 96 votes.
Khan’s Tehrik-e Insaf party won the most seats in Pakistan's July 25 general elections.
Parliament's move cleared the way for the 65-year-old Khan to set up a coalition government, after his party fell short of the 172 seats needed to control an outright majority.
Khan, a populist who ran on an anticorruption platform, promised voters a "new Pakistan."
In his first speech to lawmakers as prime minister, Khan dismissed allegations of election fraud and vowed to enforce "ruthless accountability" to combat corruption.
"I want to thank the people and I want to thank God for giving me the opportunity to bring change," Khan said in a combative speech in parliament. "Those who have robbed this country, I will hold each and every one of you accountable."
Khan also defended himself against widespread claims the powerful army had fixed the election in his favor.
During his speech, opposition politicians chanted "thief" and "puppet."
"I am here after 22 years of struggle. No dictator has taken care of me. I am standing here in this parliament on my own feet," Khan said.
The July 25 election was marred by the intimidation of some candidates, an effort to undermine the former ruling party, and media self-censorship, according to a monitoring team from the European Union.
Khan formally took office in a swearing-in ceremony on August 18.
Khan's victory marked his stunning rise from struggling politician to the highest civilian office in the country.
Born to a privileged family and educated at Britain's University of Oxford, Khan was known for his playboy lifestyle and married wealthy British heiress Jemima Goldsmith in 1996. He has since remarried twice.
During the election campaign, Khan criticized Pakistani liberals and embraced conservative Islam as a politician, promising an Islamic justice system. He allied himself with extremist religious groups with ties to militancy.
Khan's closest challenger in the election was Shahbaz Sharif from ousted former Prime Minister Nawaz Sharif's PML-N party.
Sharif's former ruling party won only 92 seats in the July elections after a corruption scandal and court ruling that led to Nawaz Sharif’s resignation and his disqualification from holding public office.