Lawmakers in Pakistan on Tuesday elected Arif Alvi the 13th president of the country, Dawn reported. Alvi, the candidate of the ruling Pakistan Tehreek-e-Insaaf party, defeated Pakistan Peoples Party candidate Aitzaz Ahsan and joint candidate of other Opposition parties Maulana Fazl ul Rehman.

The Election Commission said that 1,110 legislators, with 689 votes, voted in the elections. Alvi secured 353 votes, Ahsan got 124 votes and Rehman 185. Twenty-seven votes were declared invalid. Alvi will take oath on Sunday, a day after the tenure of outgoing President Mamnoon Hussain ends.

Alvi was expected to win because the ruling party controls the National Assembly and has majorities in the provinces of Khyber-Pakhtunkhwa and Punjab. Though the Pakistan Tehreek-e-Insaaf does not have a majority in Balochistan, it reportedly had the support of the ruling party in the province.

The president-elect thanked Prime Minister Imran Khan for nominating him and said he hoped to “get the chance to serve this post in its true spirit”, The Express Tribune reported. “Our government has a message of serving the masses,” Alvi said. “I am not the president of PTI alone, I am the president of all parties and all Pakistanis. I will try to be the president of all parties. I am thankful to the independents and our partners in allied government.”