The high court ruled that Sharif had been dishonest to Parliament and to the judicial system and was no longer deemed fit for office.
A five-judge panel announced its unanimous decision Friday afternoon. Silence enveloped the courtroom as Justice Ejaz Afzal read the judgment, and the opposition distributed candy in celebration following the verdict.
Sharif was not named in the Panama Papers, but his three children were linked in the documents to offshore companies.
The Panama Papers leak sparked mass protests in Pakistan and calls from opposition political groups for a panel to investigate Sharif and his children over their alleged offshore accounts.
Opposition: 'Victory for the people'
Reacting to the verdict, the ruling party, the Pakistan Muslim League-Nawaz, or PML-N, said the Prime Minister would accept the court's decision.
"There has been an injustice against us. Nawaz Sharif will step down as premier of Pakistan despite reservations regarding the verdict," a party statement said.
The election commission was ordered to issue a disqualification notice to Sharif. With the ruling, his Cabinet also was dissolved.
The 68-year-old leader who has been at the helm of Pakistan's turbulent politics for more than three decades was expected to vacate the Prime Minister's residence by Friday evening.
Former cricket star Imran Khan, leader of the opposition Pakistan Tehreek-e-Insaf party, or PTI, lobbied vigorously for Sharif's investigation and described the court's decision as a "victory for the people."
"Nations are not destroyed by wars, bombs or natural disasters. They are destroyed when their institutions have been destroyed," Khan said. "This is the beginning. Now all of us have to protect our resources and not let the corrupt exploit them."
But Pakistan's minister of railways blamed the military for Sharif's downfall.
"There has been an injustice against us," said the minister, Khawaja Saad Rafique, who is a member of Sharif's party. "We are very aware what the actual crime of the PM is. We want civil supremacy. We come into power through democratic means. We give our lives to bring back democracy to this country. We give power to these institutions. ... We are being punished for this."
No civilian prime minister in Pakistan has ever completed a full term in office. Friday's ruling marked the first time in the country's history that a leader was disqualified from office following a judicial process.
Sharif's term was to end next year, and he wouldn't have been able to run again because of term limits.
But with the disqualification, he can't hold any parliamentary position, become involved in election campaigns or lead his party.
General elections are scheduled for April, and the ruling PML-N is widely expected to win despite Friday's ruling.
A prominent Pakistani journalist said Sharif's resignation will "activate the streets."
"I think they are feeling that if a person with the experience of Nawaz Sharif can be ousted then, nobody will else will be allowed to 'deliver' until the elections," Nusrat Javed said. "There is a feeling that the judges have played someone else's game. It all depends on who the next prime minister will be."
A political heavyweight
Under Sharif, Pakistan has experienced economic growth and a marked drop in terrorism. The government also has initiated a bold foreign policy that led to strong ties with China and the formation of the China-Pakistan Economic Corridor.
Known as the "Lion of Punjab," Sharif is one of Pakistan's leading industrialists and richest men as well as a fearsome political operative -- having been Prime Minister twice before.
But his long political career has been dogged with missteps and allegations of corruption. He was forced to step down during his first term as Prime Minister after a family-owned business, Ittefaq Industries, grew tremendously while he was in office.
Sharif was re-elected in 1997 and ordered Pakistan's first nuclear tests, but a showdown with the nation's powerful military saw his second term end prematurely as well.
In 1999, Sharif fired then-army head Pervez Musharraf
after a failed invasion of Kargil in Indian-controlled Kashmir. But in a dramatic turnaround, Musharraf launched a coup and eventually had his former boss imprisoned on charges of hijacking for attempting to stop a plane carrying the general from landing.
Sharif was later sentenced to an additional 14 years in prison on corruption charges, but he was released after six months when Saudi Arabia brokered a deal to allow him to go into exile there.
In 2007, Sharif returned to his homeland after his PML-N party teamed up with the Pakistan Peoples Party, or PPP, to force Musharraf out of office.
After some legal and constitutional wrangling, Sharif was re-elected Prime Minister for a third time in 2013
amid accusations of vote-rigging.
Musharraf praised the court's decision and said he believed Sharif's political career was finished.
"It is finished in the minds and hearts of the people of Pakistan. It should have been finished much before but anyway, better late than never," he said Friday in an interview with India's CNN News 18.
Links to offshore companies alleged
The latest and final nail in Sharif's political coffin is not of his own making but rather the alleged financial improprieties of his children.
While owning properties is not illegal, opposition parties have questioned if the money to buy them came from public funds.
Sharif was not personally named, but three adult children were linked to offshore companies that owned properties in London. One British Virgin Islands holding firm listed his daughter, Maryam, as the sole shareholder.
The Supreme Court created a task force in April after it was unable to determine the links to corruption independently. At the time Sharif pledged to step down if anything from the investigation proved corruption.
Investigators found that Sharif held a work permit for the United Arab Emirates for a previously undisclosed company, a violation of the Pakistani Constitution, according to Friday's judgment.
In November, his daughter tweeted images of a disclosure form claiming she was not the owner of a London property. However, the document, dated 2006, used a font -- Calibri -- that did not become widely available until the following year
Maryam Sharif, who many believed was being groomed to take the reins from her father, has denied any wrongdoing.
On Friday, she tweeted
, "Another elected Prime Minister sent home, but only to see him return with greater force & support & soonest Insha'Allah."