Pakistan Tehreek-i-Insaf's (PTI) Dr Arifur Rehman Alvi has been elected the 13th President of Pakistan, according to results provided by the Election Commission of Pakistan.

Alvi, who is now set to succeed the outgoing President Mamnoon Hussain, edged out PML-N backed chief of the Muttahida Majlis-e-Amal (MMA), Fazlur Rehman and senior PPP leader Aitzaz Ahsan in the presidential race by garnering more votes than both his rivals combined.

The ECP, in a press release, said that a total of 1,110 voters participated in the presidential polls held simultaneously at the Parliament House and the four provincial assembles today. Of the total votes cast, 28 votes were declared invalid.

After the total valid votes were treated according to the provision of paragraph 18 of the Second Schedule of the Constitution, Alvi secured 352 votes, Rehman bagged 184, while Ahsan's tally stood at 124.

The Election Commission of Pakistan (ECP) has summoned the trio or their agents to the ECP Secretariat tomorrow to witness the tabulation process, after which the official result will be announced and the winner notified.

Votes breakdown

Of the 430 votes cast in the National Assembly and Senate, PTI's Alvi received 212 votes, JUI-F's Rehman bagged 131 and PPP's Ahsan garnered 81; six votes were rejected.

Of the 61 Balochistan Assembly members, 60 cast their votes, with former CM Nawab Sanaullah Zehri the sole absentee. According to provisional results reported by DawnNewsTV, PTI's Alvi secured 45 votes, while 15 lawmakers voted for Rehman. PPP's Ahsan failed to receive any vote.

In Sindh Assembly, PPP's Ahsan garnered 100 votes, Dr Alvi bagged 56, whereas just a solitary vote was cast in the favour of JUI's Rehman; one vote was wasted.

In Khyber Pakhtunkhwa Assembly, Dr Alvi received 78 of the total 109 votes, while Rehman and Ahsan had 26 and five votes respectively to their names.

In Punjab Assembly, Dr Alvi secured 186 votes, whereas Rehman and Ahsan received 141 and six votes respectively; 18 votes were rejected.

The unusually high number of rejected votes in the Punjab Assembly could be attributed to last week's murmurs that a group within the PML-N was unhappy over the party’s decision to nominate Rehman, and even termed him a “bad choice”.

'President of the entire nation'

"I am grateful to God that the PTI-nominated candidate has been successful in the presidential race today," Alvi said in his victory speech. "I am also thankful to Imran Khan for nominating me for such a big responsibility."

In his impending five-year term, Alvi said he hopes that the "fortunes of the poor" take a turn for the better, and that they get "food, shelter and clothing".

Alvi said that "from today I am not just a president that was nominated by the PTI but I am the president of the entire nation and all parties".

"Each party has an equal right on me," he added.

A joint sitting of the Senate and the newly elected national and provincial assemblies — together known as the electoral college of Pakistan — was called to elect the country's 13th president.

The voting started at around 10am and ended at 4pm. The NA and Senate members voted inside the National Assembly hall, whereas the MPAs did the same in their respective provincial assemblies.

Prime Minister Imran Khan arrives at the Parliament House to cast his vote. — Twitter

With an hour left in the 4pm voting deadline, Prime Minister Imran Khan arrived at the Parliament House and cast his vote.

The Election Commission of Pakistan had barred the members from carrying mobile phones with them at the time of voting.

Personnel of Rangers and FC were deployed around the Parliament House and the buildings of the provincial assemblies, which were declared as polling stations.

PTI's Arif Alvi casts his vote. — DawnNewsTV

With the Constitution requiring the presidential election to be held at least a month prior to the outgoing president's final day in the office, the exercise that took place today should have instead been held by August 9, as incumbent President Mamnoon Hussain's term will expire on September 9.

However, since the electoral college was not complete by the Constitutionally set deadline, the presidential election was subjected to delay.

Lawmakers cast their votes at the National Assembly. — DawnNewsTV

The exercise held today marked the end of a lengthy poll season that began with the July 25 general elections and was followed by various speaker, deputy speaker, prime and chief ministerial ballots.

The newly elected president will take oath of the office on September 9 after the expiry of the five-year term of incumbent president Hussain.

'No complaints'

While arriving at the parliament for the election, Dr Alvi told reporters that members of all political parties should "vote for the best candidate according to their conscience".

He said he expects to win a "clear majority" from all legislatures.

PPP candidate Aitzaz Ahsan arrives at parliament in Islamabad. — AP

PPP's Ahsan, who spoke to media representatives after visiting the parliament, said votes were being cast efficiently and the process was properly moving forward.

He said the matter of significance was not who from among the three candidates is elected president, but that a new head of state is going to be elected "through the democratic process".

Ahsan said he had no complaints about the election process and that he would congratulate whoever emerges as the winner.

'PPP stabbed joint opposition in the back'

Senator Maulana Abdul Ghafoor Haideri of the JUI-F said it will remain an "example in history" that the PPP "stabbed the joint opposition in the back" by refusing to accept Rehman as the opposition parties' nominee.

JUI's Haideri launches scathing criticism of PPP.

He said he believed that "apparently", the establishment's favourite party has come to power in the centre.

"The second party [backed by] the establishment has emerged in the form of PPP as an apparent part of the opposition," he alleged.

Tussle over opposition candidate

After the Election Commission of Pakistan set September 4 as the day of the 2018 presidential elections, four candidates were nominated and had subsequently filed their papers.

While the PTI and its allies have seen their candidates stave off any upsets in all the post-general election polls this summer, its presidential candidate, the PM-nominated Dr Arif Alvi, could have had a tougher task since the PTI does not have a majority in the Senate, whose members are also going to vote today.

Moreover, the presidential election is held via a secret ballot, which keeps the door open for horse-trading.

However, Dr Alvi's presidency bid was given a huge boost due to disagreements within the opposition camp.

Explore: Alvi, Rehman, or Aitzaz — who will be the next president of Pakistan?

The PPP claims it's "suggestion" to nominate Aitzaz Ahsan as the opposition's candidate was misconstrued as a finalised nomination, which did not sit well with the PML-N as Ahsan had been a front line critic of its leadership in the past.

A lawmaker arrives to cast her vote for presidential election at parliament in Islamabad. — AP

The episode reopened old wounds, and despite efforts to reconcile, a middle ground was not to be reached. PPP co-chairperson Asif Ali Zardari did not budge and stuck with his nomination of Ahsan. Meanwhile, JUI-F chief Maulana Fazlur Rehman, who had been given the task to mediate between the two parties, ended up garnering the joint opposition's support for himself; he was nominated by PML-N President Shahbaz Sharif.

A fourth candidate, PML-N's Ameer Muqam had also filed his nominated papers but withdrew from the race at the eleventh hour, possibly in Rehman's favour.

How is the president of Pakistan elected?

As mentioned above, the electoral college of Pakistan comprises six leading elected bodies of Pakistan: the Senate, the National Assembly and the four provincial assemblies.

Of the sextet, the Senate and the NA's members are given one vote each. However, the four provincial assemblies are assigned an equal weight with the smallest of them all — the Balochistan Assembly — serving as the base.

Read: How PTI is poised to take President House in upcoming election

The Balochistan Assembly has 65 members while the strength of the Khyber Pakhtunkhwa Assembly is almost double this number, i.e. 124; so the vote of a member of the KP assembly has half the value of the vote of a member of the Balochistan Assembly.

According to the rules, the votes polled for candidates in Punjab, Sindh and Khyber Pakhtunkhwa assemblies are multiplied by 65 and divided by the total strength of that house, i.e. 371, 168 and 124 respectively. The values obtained are then rounded off.