A Pakistani court has ordered the release of ex-Prime Minister Nawaz Sharif, two months after he began a 10-year jail sentence over corruption.

The court suspended the sentences of Sharif and his daughter Maryam, who were convicted in July, shortly before the country held general elections.

His party lost to Imran Khan's Pakistan Tehreek-i-Insaf (PTI) later that same month.

The decision came during the Sharifs' appeal. They have denied wrongdoing.

The ruling comes just a week after Sharif's wife, Kulsoom Nawaz, died from cancer in London.

They were briefly allowed out of prison, in Rawalipindi, to attend her funeral in Lahore, but were later returned.

What was the case about?
Sharif was sentenced in July after being found guilty of corrupt practices related to the ownership of four luxury properties in central London linked to his family.

He says the charges are politically motivated. The three-time prime minister was ousted from power a year earlier by Pakistan's Supreme Court, after his children were linked to offshore companies in the Panama Papers leaks of 2015.

His daughter, Maryam Nawaz Sharif, received seven years for abetting a crime and one year for not co-operating - which were due to run concurrently - while son-in-law Safdar Awan was given a one-year sentence for not co-operating.

The conviction also barred them from seeking public office for up to 10 years after release.

What changed on Wednesday?
All three had the jail sentences imposed by the lower court on 6 July suspended by Islamabad's high court, as part of an appeals hearing.

"The prosecution has failed to show the properties belong to Nawaz Sharif. It also failed to prove how was Maryam Nawaz sentenced under the same charge sheet which convicted Nawaz Sharif," Justice Athar Minallah told the court.

Their convictions remain under appeal within the top court, but a date for a hearing has yet to be fixed. The anti-graft body that launched the case, the National Accountability Bureau, can still appeal to the Supreme Court against the latest ruling.

The Sharifs are expected to be released soon on bail.

What has the reaction been?
The case against Nawaz Sharif has divided opinion in Pakistan.

Supporters of Sharif cheered outside the court when it gave its order to release him, while Maryam Aurangzeb, who served as deputy minister of information under Sharif, was filmed wiping her eyes.

The leader of Sharif's PML-N party said the ruling was "a victory for justice", according to Pakistan's Express Tribune.

But a senator from Prime Minister Khan's PTI party, Faisal Javad, told a local TV channel: "It is only a suspension. But they are guilty all the same. Their destination remains Adiala Jail."

Sharif had been serving as prime minister for a record third time when he stepped down last year.

He also held the office from November 1990 to July 1993 and from February 1997 until he was toppled in a bloodless coup in October 1999.