The promised reinstatement of Pakistan's chief justice defused a protest movement threatening the US-allied government, but it could still spell trouble for the country's struggling president. The army is said to have directed President Asif Ali Zardari to defuse the developing showdown with opposition leader Nawaz Sharif and lawyers leading a column of protesters toward the capital Sunday night. But by yielding to demands to restore judges fired by former military ruler and US ally Pervez Musharraf, Zardari may have strengthened democracy in the nuclear-armed nation as it faces daunting security and economic challenges. “Never before in Pakistan's political history have you had people standing up for the rule of law, for the constitution,” said Nasim Zehra, a political and defense analyst. “Civil society has won out.” Musharraf ousted Chief Justice Iftikhar Mohammed Chaudhry in 2007 after he blocked a privatization deal, investigated the fate of hundreds of people allegedly held incognito by security agencies, and even questioned the legality of the ex-general's rule. But the move backfired as lawyers, rights activists, liberal media pundits – as well as the general's political opponents – mounted a dogged campaign for an independent judiciary that turned the dour, mustachioed judge into an unlikely democratic icon. The very same constellation has now humbled Zardari. The slaying of former premier Benazir Bhutto catapulted her Pakistan People's Party into power last year. Zardari, who took over his wife's party and became president, forged a coalition with Sharif. The alliance collapsed as the two wrangled for power and Zardari reneged on a pledge to restore Chaudhry. Sharif joined the opposition, but last month the Supreme Court ruled that he and his brother Shahbaz were ineligible for elected office. Zardari then dismissed the government Shahbaz led in Punjab, the most powerful Pakistani province. Nawaz Sharif – who defied house arrest to participate in Sunday's demonstration – accused Zardari of a power grab and urged his supporters to join lawyers and other activists planning to march on the capital, re-energizing the movement. Zardari's tough line also opened rifts in his party, which could weaken his grip and force him to pass on to Parliament some of the sweeping presidential powers accumulated by Musharraf, analysts said. He has pledged to give up the right to dissolve the assemblies and fire the government – but taken no concrete steps to do it. “Zardari has come out badly bruised,” said Zahid Hussain, a Pakistani commentator. “He has managed to survive, but his power has certainly been curtailed.” Sharif, in contrast, has emerged triumphant. The popular two-time former premier may believe his championing of Chaudhry's cause will help reverse the court decisions that triggered the latest turmoil, but any hopes of a return to power via early elections appear to have vanished. “He is much, much stronger politically after this crisis, but he will still have to wait until the next election” another four years away, Hussain said. Sharif recently told The Associated Press that he would accept the court decision and leave Zardari's Pakistan People's Party to finish its term if it brought back Chaudhry. The government now, however, plans to appeal the court ruling, a move welcomed by Sharif's party. Chaudhry will be under intense scrutiny when he returns to work Saturday, and legal experts expect him to let colleagues decide cases where he might be considered partial. Zardari's camp had painted Chaudhry as too politicized to return to such a critical post. But critics suspect the president also fears the 60-year-old would allow legal challenges to a controversial pact signed by Musharraf that quashed corruption cases against Zardari and Bhutto that paved their way back from exile. Hasan Askari Rizvi, author of several books about Pakistan's military, said while the details of any secret deal that secured Chaudhry's return were unknown, it appeared that the army wanted to avoid confrontation between the executive and the judiciary. Farahnaz Ispahani, a spokesman for Zardari's party, acknowledged that army chief Gen. Ashfaq Parvez Kayani had played a “positive role” in resolving the crisis, but declined to provide details. The army would also likely frown on any efforts to prosecute Musharraf. Sharif, who was ousted in Musharraf's 1999 coup and sent into exile, accuses the ex-general of treason. Even if court cases are eventually revived against Zardari, he enjoys immunity under the constitution so long as he remains president. The constitution does allow for impeachment. For America, the prospect of Chaudhry grilling Pakistani security officials about the fate of hundreds of missing persons could be uncomfortable. Some are suspected terrorists believed to have been secretly sent to America following the Sept. 11, 2001, terror attacks. Yet President Barack Obama seems more concerned about Pakistan's ability to help turn around the faltering war effort in Afghanistan than the risk that Chaudhry could cast more harsh light on the counterterrorism tactics of the Bush administration. The American Embassy immediately congratulated Zardari, who has won praise from Washington for urging Pakistanis to eradicate religious extremism, for his “statesmanlike decision” to restore Chaudhry and called on Pakistanis to unite and face their challenges. State Department spokesman Robert Wood said the decision by Pakistan's leaders had “brought Pakistan back from the brink.” Secretary of State Hillary Rodham Clinton had called both Zardari and Sharif to voice concern.