Pakistan's Supreme Court has overturned a ban that prevented opposition leader Nawaz Sharif and his brother Shahbaz from running for political office.
The ruling means Mr Sharif will be able to stand in elections due in 2013 or a parliamentary by-election before then.
The former prime minister and leader of the PML-N party is one of the most popular politicians in the country.
Mr Sharif's ban related to old convictions which he has always said were politically motivated.
He lost power in a bloodless coup led by then army chief Pervez Musharraf in 1999, and was forced into exile a year later in Saudi Arabia.
But in November 2007 Mr Sharif was allowed to fly back to Pakistan, and helped force President Musharraf from office in 2008.
Sharif supporters broke into cheers soon after the Supreme Court made its judgement on Tuesday and began dancing to drums outside the court premises.
Mr Sharif is free to enter parliament
"The decisions of the court must be acceptable to the people," Mr Sharif told a Lahore press conference soon after the ruling.
"I salute the people of Pakistan who have freed the judiciary.
"We want a system based on justice, and for that to happen democracy must now deliver."
Earlier this year, the Supreme Court ruled that Mr Sharif was not eligible to hold public office, prompting him to accuse President Asif Ali Zardari of being behind the move.
The two men formed an uneasy alliance after a sweeping win in last year's general elections, but they soon fell out.
The Supreme Court ruling on Tuesday - made by a five-member bench - reversed an order made by a three-member bench in February which declared that the Sharif brothers were ineligible to hold office.
That ruling was disputed by the Sharifs - they said it was delivered by judges appointed by former President Musharraf in place of others sacked by him.
Nawaz Sharif subsequently started a campaign to restore the sacked judges, who were reappointed after nationwide protests.
The PML-N is one of the two largest political parties in Pakistan.
The BBC's Syed Shoaib Hasan in Islamabad says the latest ruling means that most criminal and civil cases pending against the Sharif brothers are now overturned. Many of these were registered during President Musharraf's rule.
Our correspondent says Nawaz Sharif is still fighting one conviction - for the "hijacking case" of 1999 in which he allegedly tried to prevent then Gen Musharraf from returning to the country by ordering the pilot of his flight not to land.
Mr Sharif had sacked the army chief, but the general was still able to land and went on to lead the coup against him.
Mr Sharif's lawyers say they expect this conviction too will soon be overturned and that it will not prevent him from immediately returning to politics, contesting elections and sitting in parliament.