An independent candidate backed by the ruling PML-N on Thursday comfortably cruised to victory in a by-election on a Senate seat vacated after the disqualification of former senator Nehal Hashmi.

Dr Asad Ashraf bagged 298 votes in the 368-member Punjab Assembly — where the polling for the by-election took place — defeating Pakistan Tehreek-e-Insaf (PTI) candidate Dr Zarqa Suharwardi-Taimur, who managed to obtain 38 votes.

Ashraf had submitted his papers for the election as a PML-N nominee but was declared an independent candidate after a Supreme Court verdict restrained Nawaz Sharif from heading the PML-N and also set aside all his previous decisions.

According to a notification issued by the returning officer, the number of valid votes cast for the by-poll was 336. Twelve votes were declared invalid while two votes were spoilt or cancelled.

The PML-N backed candidate who was required to obtain at least 169 votes to be elected to the seat managed to secure 298 votes, defeating PTI's Zarqa by 260 votes.

Talking to reporters after being elected, Ashraf said he had been declared independent due to the court's decision, but "Today I sacrifice my independence... in the feet of Mian Nawaz Sharif."

After the results were announced, PML-N leader Maryam Nawaz tweeted that all MPAs of her party who were present in the assembly had voted for Ashraf.

"What did you achieve by taking away the party's [PML-N] name and symbol, except for failure, disrepute and disgrace?" she wrote, apparently addressing the higher judiciary of the country, in a reference to the SC ruling stating that Nawaz Sharif could not remain PML-N president.

Punjab Chief Minister Shahbaz Sharif, who was recently elected the PML-N acting president, also celebrated Ashraf's victory in a tweet.

"Punjab MPAs prove all naysayers wrong by electing Dr Asad Ashraf with [an] absolute majority. I dedicate this victory to the leadership of Muhammad Nawaz Sharif," he wrote.

The Election Commission of Pakistan had announced the Senate by-election after Hashmi, who was elected to a general seat on a PML-N ticket in 2015, was disqualified last month after being convicted of contempt of court.

Hashmi, who had in March 2017 lashed out at the Panamagate JIT and warned investigators that they would be "taken to task" for grilling the former premier's family, was sentenced to a month in jail and barred from holding public office for the next five years. He had also been handed a Rs50,000 fine by the apex court.

After completing his one-month sentence, Hashmi was released from Adiala Jail on Wednesday.