Nawaz Sharif has resigned as prime minister of Pakistan following a decision by the country's Supreme Court to disqualify him from office.
The ruling came after a probe into his family's wealth following the 2015 Panama Papers dump linking Mr Sharif's children to offshore companies.
Mr Sharif has consistently denied any wrongdoing in the case.
The five judges reached a unanimous verdict in the Islamabad court, which was filled to capacity.
"Following the verdict, Nawaz Sharif has resigned from his responsibilities as prime minister," a spokesman for Mr Sharif's office said in a statement.
There was heightened security in the capital, with tens of thousands of troops and police deployed.
One of the judges, Ejaz Afzal Khan, said that Mr Sharif was no longer "eligible to be an honest member of the parliament".
Pakistan's Interior Minister Chaudhry Nisar Ali Khan earlier advised Mr Sharif to accept Friday's verdict.
The court has recommended anti-corruption cases against several individuals, including Mr Sharif, his daughter Maryam and her husband Safdar, Finance Minister Ishaq Dar and others.
Mr Sharif, who was serving as prime minister for a record third time, was less than a year away from becoming the first in Pakistani history to complete a full term in office.
He served as prime minister from November 1990 to July 1993 and from February 1997 until he was toppled in a bloodless coup in October 1999.
Allegations of corruption have dogged Mr Sharif since the 1980s. And much of what the Panama Papers revealed was the subject of a federal inquiry in the mid-1990s.
What happens next?
It is not immediately clear who will succeed Mr Sharif, but his brother Shehbaz, who is chief minister of Punjab province, is seen as a strong contender for the job.
Pakistan's ruling party, the Pakistan Muslim League-Nawaz (PML-N), will be permitted by the speaker of the National Assembly to select an interim prime minister to rule until the 2018 general election.
The PML-N, which has the most seats in parliament, is expected to deliver a statement later on Friday.
Opposition parties will also have the opportunity to put forward their own candidates for the position.
Meanwhile, the court has directed the National Accountability Bureau (NAB), the main anti-corruption body, to compile and send four references to accountability courts against Mr Sharif and others.
The NAB has been directed to file these references within six weeks. The accountability courts have been directed to complete hearings in these cases in six months.
What did the Panama Papers reveal?
The leaks in April 2016 revealed that three of Mr Sharif's children owned offshore companies and assets not shown on his family's wealth statement.
The companies were allegedly used to channel funds to acquire foreign assets, including some apartments along Park Lane in London's Mayfair area.
The insinuation that the companies were meant to hide or launder ill-gotten wealth or to avoid taxes called Mr Sharif's credentials into question.
What is the mood in Pakistan?
Local media on Friday showed crowds assembled outside the Supreme Court in Islamabad cheering the court's verdict.
As the verdict was announced, opposition supporters erupted in applause, rushing into the street chanting slogans and handing out sweets, according to reports.
The vice-chairman of the Pakistan Tehrik-e-Insaf (PTI) party, Shah Mehmood Qureshi, called it an "historic day" and praised the Joint Investigation Team (JIT) for "not succumbing to the enormous pressure and serving the cause of justice."
The verdict was announced amid heightened security in the capital, with about 3000 armed police and members of the Pakistan Rangers paramilitary force deployed near and around the Supreme Court.
The ruling represents the peak of a drama that has fuelled news coverage and social media debates for months, attracting both scorn and ridicule as well as trenchant support for the prime minister.
The divisions fall largely along party lines but amid the febrile accusations, many have also expressed concerns over Pakistan's political culture.
The Wikipedia profile of the prime minister has also been littered with obscenities and accusations.
Mr Sharif is not the first prime minister to lose his position following the leaking of documents from the Panamanian law firm.
Iceland's prime minister was forced to resign after documents appeared to reveal that he and his wife concealed millions of dollars' worth of investments in an offshore company.
- BBC