LAHORE (Reuters) - Pakistan’s main opposition party called on Sunday for a judicial investigation into what it said was rigging at an election this week that it lost.

Ousted Pakistani Prime Minister Nawaz Sharif sits on a plane after landing at the Allama Iqbal International Airport in Lahore, Pakistan, July 13, 2018. REUTERS/ Drazen Jorgic

Imran Khan’s Pakistan Tehreek-e-Insaf, or Pakistan Movement for Justice, emerged as the largest single party in Wednesday’s vote, defeating the Pakistan Muslim League - Nawaz (PML-N) party of jailed former prime minister Nawaz Sharif.

During the campaign, Sharif said the military had influenced the judiciary to deny him a second term. The military denied this. It has ruled Pakistan for about half the time since the country’s formation in 1947.

“We demand constitution of a judicial commission to probe incidents that took place on July 25,” senior party leader Khawaja Asif told reporters in Lahore. “We will issue a white paper on the election rigging and other incidents.”

“PML-N will not accept these elections as legitimate and we are ready to ... start movement along with other parties,” Mushahid Ullah Khan, a senior leader, told reporters.

PTI did better than expected to win 16.86 million votes and beat PML-N, which got nearly 13 million votes. PTI opened coalition talks with at least one smaller party and independent politicians on Saturday.

European Union observers were critical of the political climate in the run-up to the vote, saying that some parties had been disadvantaged. The United States voiced similar concerns.

“Pakistan witnessed the most disputed elections in the country’s history,” Ahsan Iqbal, a senior leader of PML-N and former interior minister, told reporters.

Sharif was taken to hospital in Islamabad on Sunday with a possible heart problem, said a government official and Sharif’s party.

Sharif and his daughter Maryam were arrested on July 13, minutes after they returned from Britain seeking to revitalise their flagging PML-N party ahead of a July 25 election.

An anti-corruption court sentenced him on July 6 to 10 years while his daughter and political heir was sentenced to seven years over the purchase of luxury flats in London in the 1990s.

They were moved to Adiala jail in the garrison town of Rawalpindi.

“After initially refusing to be shifted to Pakistan Institute of Medical Sciences ... Sharif agrees to be treated outside prison after consulting with his personal doctor,” said a PML-N tweet on Sunday night.

“Doctors at Adiala jail have observed changes in the ECG (electrocardiogram) of Nawaz Sharif,” Punjab Chief Minister Hasan Askari Rizvi told Reuters. An ECG checks the heart’s electrical activity.

“We cannot take any risk about Sharif’s health,” Rizvi said.