* Corruption allegations stem from leaked "Panama Papers"
* Two of five judges rule to remove PM Nawaz Sharif
* Sharif and his family celebrate decision as vindication
* Court orders further investigation into opposition allegations
Islamabad: Pakistan's Supreme Court on Thursday ruled there was insufficient evidence to order Prime Minister Nawaz Sharif's removal from office over corruption allegations levelled by the opposition and it ordered further investigations.
A verdict to dismiss Sharif would have left his party in power but would have sparked turmoil at a time when Pakistan is experiencing modest growth and improved security, and the civilian government and powerful military have appeared to come to uneasy terms.
Pakistan's stock market jumped after the ruling with the benchmark index gaining almost 2 percent. Sharif is seen as pro-business.
Two of five judges on the court bench recommended that Sharif should step down but they were out voted.
The court ordered a joint investigation team to be formed to look into allegations around three of Sharif's four children using offshore companies to buy properties in London.
Sharif and his children deny any wrongdoing.
The team has two months to complete its inquiry.
Analysts and opposition politicians said the ruling was a blow to Sharif's credibility and the inquiry's findings could yet weaken the prime minister as he heads into a general election, due by May 2018.
But for now, Sharif and his ruling Pakistan Muslim League-Nawaz, are celebrating.
Sharif's daughter and his presumptive political heir, Maryam Nawaz Sharif, posted a photo on her Twitter account of the family welcoming the court's decision.
"We are ready for all kinds of investigation," Sharif's defence minister, Khawaja Asif, told reporters outside the court.
The Supreme Court agreed last year to investigate the Sharif family's offshore wealth after opposition leader Imran Khan threatened street protests following the leaking of the "Panama Papers" in 2015.
Khan called on Sharif to step down until the investigation was completed.
"The prime minister should immediately resign at least for the 60 days until JIT completes its work," Khan told reporters, referring to the joint investigation team.
"How can he continue as prime minister when he is being investigated? What moral grounds does he have to continue in office?"
Documents leaked from the Panama-based Mossack Fonseca law firm appeared to show that Sharif's daughter and two sons owned offshore holding companies registered in the British Virgin Islands and used them to buy properties in London.
The opposition accuses Sharif of failing to explain the source of offshore money and of lying to parliament.
Sharif, one of Pakistan's richest men, told parliament last year that his family wealth was acquired legally in the decades before he entered politics.
The president of the Supreme Court Bar Association said the ruling showed that none of the judges had accepted the truthfulness of Sharif's speech to parliament.
"That is very damaging to the prime minister," Rasheed Razvi said.
Farogh Naseem, a Supreme Court lawyer and sitting senator, said Sharif could breathe easy, for now.
"It was a close call for the prime minister," he told Reuters. "There is no clean chit for the prime minister, but for the time being he has been saved from being disqualified."
Naseem said that with three of the institutions involved in the joint investigation under Sharif's control, a decision against him was unlikely.
Khan's party has indicated that it would not launch a new street protests if it was disappointed by the judgement.
Pakistani politicians of all stripes have over the years been accused of corruption, which remains endemic.
Saadia Toor, associate professor at City University New York, said the scourge of corruption extended far beyond Sharif and offshore wealth.
"Definitely there should be accountability regardless of who is in power but it's important to have governments that sit out their terms because there is so much instability," Toor said.