Imran Khan secured 178 votes against the 172 required to win vote of confidence, the speaker of the house announced.
Islamabad, Pakistan – Pakistan’s Senate elected ruling alliance candidate Sadiq Sanjrani as chairman of the upper house of parliament, after a fractious election that saw the opposition accuse the government of installing “spy cameras” over the ballot booth.
Sanjrani, the incumbent whose candidacy was supported by Prime Minister Imran Khan, received 48 votes, with the opposition’s Yusuf Raza Gilani receiving 42 votes in the election on Friday.
“Mr Sadiq Sanjrani has received 48 votes, Mr Yusuf Raza Gilani 42 votes,” announced election presiding officer Syed Muzaffar Hussain Shah, to widespread cheers and celebrations from the treasury benches.
The opposition protested the result after Shah earlier announced he was rejecting seven ballots in favour of Gilani for having the voting stamp placed on the candidate’s name, rather than the designated box.
“Instead of the box, the stamp has actually been affixed on the name of Syed Yusuf Raza Gilani, and they are rejected,” said Shah.
Pakistan People’s Party Senator Farooq Naek contested the presiding officer’s verdict. The opposition can file an appeal with an independent election tribunal.
The result further strengthens the hold of Prime Minister Khan’s ruling alliance over the Senate, where it is the largest single party, although the opposition alliance outnumbers the treasury benches in absolute numbers.
Sanjrani is a member of the Balochistan Awami Party (BAP), a member of the ruling alliance, and hails from the southwestern province of Balochistan.
Earlier in the day, opposition Senators Mustafa Nawaz Khokher and Mussadik Malik alleged they had found six “spy cameras” around the polling booth in the upper house of parliament.
The two senators shared images of what appeared to be at least two hidden and one visible camera that were pointed at the area where senators were to fill out their ballots.
A bipartisan Senate committee has been formed to probe the allegations.
Elections for the Senate and its officeholders are conducted by secret ballot according to the constitution of the country. Last week, the Supreme Court rejected a government move to require voting be done by public ballot.
The allegations came after former three-time Prime Minister Nawaz Sharif issued a video statement a day earlier, taking square aim at the country’s powerful military, warning it not to interfere in the elections.
Pakistan’s military has directly ruled the country for roughly half of its 74-year history, and has taken an increasingly active role in governance under Khan’s government.
Friday’s election comes after the election of 48 new senators to the upper house of parliament in a hotly contested poll in the country’s national and provincial assemblies.
Khan’s ruling Pakistan Tehreek-e-Insaf (PTI) lost a key seat in that election, but met expectations by emerging as the largest single party in the house.
Following the election on Friday, the PTI reiterated its commitment to implementing electoral reforms that would lessen the chances of electoral fraud.
“Pakistan will go towards e-voting, and those who lose will have to accept their defeat,” said PTI Senator Faisal Javed Khan.
Asad Hashim is Al Jazeera’s digital correspondent in Pakistan. He tweets @AsadHashim