Former Pakistani prime minister Nawaz Sharif was released from prison late on Wednesday to be met by jubilant supporters after a court suspended his prison sentence for corruption pending an appeal hearing.

Sharif -- who was ousted from office last year by the Supreme Court for alleged corruption -- was freed along with his daughter. Sharif and Maryam Nawaz were arrested on their return in July from London to campaign in elections.

Hundreds of his supporters had gathered outside Adiala prison in the garrison city of Rawalpindi to await their release. An AFP reporter at the scene said Sharif, Maryam and his son-in-law Captain Safdar were driven away in an SUV as it was pelted with rose petals in celebration.

Images showed Nawaz's younger brother Shahbaz Sharif waving at supporters from the front seat of the vehicle. Dozens of jubilant supporters chanted "Prime Minister Nawaz Sharif!" outside the Islamabad High Court after the decision was announced.

The court has not yet released a detailed judgement explaining the decision. It was not clear when Sharif's appeal will be heard. The anti-graft watchdog has the right to go to the Supreme Court to contest Wednesday's bail ruling.

An anti-corruption court in July sentenced Sharif in absentia to 10 years and his daughter to seven years over properties they allegedly owned in Britain, following revelations in the Panama Papers.

"Today the court has suspended the decision that was based on revenge," former minister Ahsan Iqbal told reporters.

"This trial is important because even a blind person in Pakistan will see that there was neither law nor constitution in the decision and it was just pre-poll rigging to pave the way for Imran Khan to win elections," he said.

Sharif, now 68, has been prime minister three times but power has been a rough ride. He was expelled from office in 1993 on suspicion of corruption. He won an election in 1997, only to be ousted and exiled after a military coup in 1999.

Nawaz returned to Pakistan in 2007 and took power once more in 2013, only to be ousted by the Supreme Court in July last year.

Read more: IHC orders release of former PM Nawaz Sharif