ISLAMABAD (Reuters) - Pakistan’s ruling party gained control of parliament’s upper house in a secret ballot on Saturday, local media said, in a boost for the Pakistan Muslim League-Nawaz (PML-N) party ahead of a general election due in summer.

Pakistan's former prime minister Nawaz Sharif speaks during a news conference in Islamabad, Pakistan September 26, 2017. REUTERS/Faisal Mahmood

The result may revive the political fortunes of ousted prime minister Nawaz Sharif, who has clashed with the judiciary since the Supreme Court ended his premiership in July by disqualifying him from office over undeclared assets.

“PMLN now the single largest party in Senate as well, Masha’Allah,” tweeted Sharif’s daughter and presumed heir, Maryam Nawaz Sharif.

Candidates backed by PML-N won 15 of the 52 seats up for grabs, overtaking Pakistan Peoples Party (PPP) as the biggest group in the upper house, according to Geo TV channel and other media. PPP candidates won 12 seats.

Working with allied parties in the senate, PML-N should have de facto control of the 104-seat chamber.

Lawmakers from the four provincial assemblies and the federal parliament voted in secret on the new senators, who are due to serve six-year terms. Unlike the last senate elections in 2015, lawmakers were not even allowed to take their phones into the assemblies during the vote.

Winning control of the Senate could enable the PML-N to change the constitution to make Sharif eligible to hold office again when the party contests a national election due later this year.

PML-N has not spoken about amending the constitution, but it has been on a collision course with the judiciary since the Supreme Court ousted Sharif from power.

Last month the top court again disqualified Sharif by removing him as head of PML-N, the political party he founded. Sharif has been deeply critical of the judiciary, accusing it of a conspiracy to hurt his party and Pakistan’s civilian leaders.

Mushahid Hussain Sayed, who won a seat in capital Islamabad, told media that the senate victory vindicates Sharif’s political “narrative” with voters.

The official results will not immediately show how well PML-N has done because a number of candidates were barred from running under the party’s banner after Sharif was removed from office.

Those candidates, who will be running as “independents”, are expected to pledge their allegiance to PML-N if they are elected to the senate, PML-N party officials say.

Under Pakistan’s constitution a bill cannot become law unless it is passed by both upper and lower houses of parliament.