By Syed Raza Hassan and Saad Sayeed
ISLAMABAD (Reuters) - 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, but it ordered further investigations.
A verdict to dismiss Sharif would have left his party in power but would have brought 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.
Two of five judges on the court bench recommended Sharif should step down, saying he was dishonest "to the nation as well as to the parliament", but they were out voted.
Presenting its 549-page judgment amid tight security in the capital Islamabad, the court ordered a joint investigation team be formed to look into allegations around three of Sharif's four children using offshore companies to buy properties in London.
The team has two months to complete its inquiry, after which a special bench will decide what action to take, the court said in a ruling that opens with the epigraph from Mario Puzo's novel "The Godfather": "Behind every great fortune there is a crime".
The prime minister and his children deny any wrongdoing.
Pakistan's stock market jumped after the court's decision with the benchmark index <.KSE> closing up 2.39 percent. Sharif is seen as pro-business.
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 Twitter of the family welcoming the court's decision.
"We are ready for all kinds of investigation," 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 protests after the leaking of the "Panama Papers".
"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. "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 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 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.
(Writing by Tommy Wilkes; Editing by Robert Birsel and Janet Lawrence)