Deposed prime minister Nawaz Sharif, center, arrives at an anti-corruption court in Islamabad, Pakistan, on Tuesday. (Pakistan Muslim League/Via AP)

The House of Sharif, one of Pakistan’s two great political dynasties, is looking more and more like a house of cards. Yet against all odds, deposed prime minister Nawaz Sharif seems determined to keep it standing. 

For much of the past three decades, the billionaire industrial family has controlled Pakistan’s wealthiest and most influential region, Punjab province. Sharif, 67, has been elected prime minister three times and remains one of the country’s most popular politicians.

But time and again, Sharif and his clan have run afoul of the military, which is suspicious of his desire to reach out to India and his attempts to establish civilian supremacy. In 1999, he was ousted by the army and sent into exile. Elected again in 2013, he was removed from power by the Supreme Court two months ago after a court battle with opponents who accused his family of hiding their wealth overseas.

Yet here he was Tuesday, flying in from mini-exile in London to face new corruption charges that could lead to his imprisonment and defiantly vowing to lead his party to victory in next year’s national election. It was a bold move, but one that analysts said could create months of turmoil ahead of the vote, endangering the fragile civil-military balance of power. 

“I will continue to fight this case,” a grim-looking Sharif said at a news conference after briefly appearing at the National Accountability Court here. Declaring that Pakistan’s “constitution and democracy” are at stake, he said, “I believe that God and the people of Pakistan are with me, and I still hope that justice is alive somewhere.” 

Sharif’s supporters cheer as he arrives for a hearing on corruption charges in Islamabad on Tuesday. (T. Mughal/Epa-Efe/Rex/Shutterstock)

The “big decision,” he added, “will come in 2018, with the general elections in my favor.”

The stunning about-face came as Sharif’s family and its once-formidable political machine, the Pakistan Muslim League-N, appeared to be falling apart amid a cascade of political and legal challenges after the July 28 high-court ruling that permanently barred Sharif from parliamentary office for having been “dishonest” with the public.

It also came at a tense moment in Pakistan’s relations with the United States, after President Trump accused the military of harboring insurgents and terrorists. At the U.N. General Assembly last month, Pakistan’s prime minister, Shahid Khaqan Abbasi, warned that his country would not be made a “scapegoat” for Afghanistan’s problems and said it was “galling” to be criticized by Trump given Pakistan’s sacrifices in the war on terrorism.

Sharif won praise from some quarters for bowing to the law and returning home from London, essentially issuing a challenge to the military and its allies in the civilian establishment. But even some supporters worried that he would go too far.

“Nawaz Sharif’s ordeal hasn’t ended, but his decision to return shows he has courage and that those who said he was running away were wrong,” said Aftab Khan Sherpao, a veteran legislator. “He is still popular with voters. If he keeps his nerve and opts for doing politics in a calm manner, he could return his party to power in 2018. But if he chooses defiance, there would likely be a confrontation between state institutions, which is not good for him or the country. He needs to hold his horses.”

At the same time, rumors have flooded Pakistani news and political circles that Sharif has been trying to make a deal with the military establishment to avoid prison. After he was ousted in 1999, the military allowed him to go into exile in Saudi Arabia. This time, though, any agreement also would have to include the judiciary, which has been pursuing the Sharifs relentlessly for months. 

Sharif seems remarkably upbeat, given the circumstances. He often mentions the cheering crowds that greeted him after he stepped down and traveled home to Punjab. More recently he has been buoyed by growing disarray in the main opposition party, led by cricket star Imran Khan, and by a parliamentary proposal that would allow him to head the Muslim League again.

Yet the tense political drama of the past several months has caused increasingly deep rifts within Sharif’s family and party as the legal and political woes accumulate. The disputes first erupted over who would be named to replace Sharif in Parliament and as the next candidate for prime minister. 

His younger brother Shahbaz, 66, always portrayed as a party workhorse and wise consigliere, reportedly was humiliated when Nawaz passed him over twice, first choosing Abbasi to replace him as premier and then having his wife Kulsoom, who is hospitalized with cancer in London, run in absentia for his legislative seat. Shahbaz, the chief minister of Punjab, fled his post and fumed silently in London as the campaign unfolded.

On the other side of the clan divide is Sharif’s daughter ­Maryam Nawaz, 43, a controversial figure who has emerged as his chief defender and heiress apparent. Sharif put her in charge of his wife’s campaign in Lahore, where she ran it as a referendum on her father’s character, calling the legal cases against him a “farce” and asking voters to take revenge at the ballot box.

Maryam Nawaz is also in serious legal trouble, along with her husband and two brothers. Her role in several offshore family properties, including charges of doctoring papers, was a centerpiece of the Supreme Court case. Now she and the others have been summoned by the accountability court on new corruption charges, but only her father has responded to the allegations.

The Muslim League “has needed deep reflection. . . . But princes and princesses aren’t capable of reflection. This is the curse of genetic transfers of political capital,” commentator Mosharraf ­Zaidi wrote last month in the News International newspaper. “The Sharif clan seems destined to be the protagonists of a cautionary tale of too much power over too long a period.”

The taint of corruption has extended to Sharif’s political family, as well. His longtime finance minister, Ishaq Dar, was indicted Wednesday on charges of graft and possessing assets beyond his means, and the court also has reopened an old case related to a paper mill owned by the Sharif family. Dar was accused of money laundering and concealing wealth on behalf of the Sharifs.

Rifts among Nawaz Sharif’s aides and advisers have become more public and intense as problems have multiplied. Most recently, his inner circle has been divided over whether he should defy the legal summons or take his chances in the anti-corruption court.

For days last month, they huddled in London — where a row of luxury apartments owned by the Sharifs became the salient image of a court battle that consumed Pakistan for months. Now, by getting on a plane and making a brief appearance in an Islamabad court last week, Sharif has left his critics agape, his loyalists cheering and those who predicted the downfall of the House of Sharif scrambling to rewrite their scripts.