Shahadat Awan, a prosecutor, said the court's decision was unanimous.

'Mid-flight drama'

Sharif was accused of refusing to allow a commercial airliner with Musharraf and 200 passengers on board to land in Karachi October 12, 1999.

Profile: Nawaz Sharif

Musharraf was returning to Pakistan from Sri Lanka after he had been sacked as army chief by Sharif.

Hours after eventually landing, Musharraf launched a coup in which he took power as president of Pakistan, and Sharif went into exile in Saudi Arabia.

Musharraf had said that when the the Pakistan International Airlines plane eventually landed, only about seven minutes of fuel were left.

Sharif returned home in 2007 and later filed an appeal against his conviction in the hijacking case that barred him from office.

Earlier this year, the supreme court ruled Sharif was not eligible for office, prompting him to lead nationwide protests against the government of Asif Ali Zardari, the Pakistani president.

Friday's ruling is the third in the past two months to lift a ban on Sharif's participation in elections and paves the way for him to contest a parliamentary ballot scheduled for 2013.