ISLAMABAD (Reuters) -- Pakistan's government agreed on March 16 to reinstate Iftikhar Chaudhry as chief justice to defuse a political crisis and end a street agitation threatening to turn into violent confrontation.
Chaudhry became a cause celebre after being dismissed in late 2007 by then-president and army chief General Pervez Musharraf.
"I announce the restoration of all deposed judges including Mr. Iftikhar Chaudhry according to a promise made by the president of Pakistan and myself," Prime Minister Yousaf Raza Gilani said in a televised address to the nation.
Opposition leader Nawaz Sharif had thrown his support behind the anti-government lawyers' protest campaign that had threatened to bring turmoil to nuclear-armed Pakistan as the government struggles to stem militancy and revive a flagging economy.
After the prime minister's announcement, Sharif called off a "long march" protest making its way to the capital, Islamabad.
The political crisis gripping the Muslim nation had alarmed the United States and Britain, which fear any slide into chaos would help the Taliban and Al-Qaeda become stronger in Pakistan.
The United States welcomed Chaudhry's reinstatement.
"This is a statesmanlike decision taken to defuse a serious confrontation, and the apparent removal of this long-standing national issue is a substantial step toward national reconciliation," the U.S. embassy said.
The government is also struggling with an ailing economy that was bailed out with a $7.6 billion International Monetary Fund package in November.
Pakistan's main stock index, hurt by political worry over the past few weeks, surged more than 5 percent at the open.
But some analysts saw Chaudhry's comeback adding to Pakistan's complexities.
"The reinstatement...will further complicate politics," said Brian Cloughley, a British defense analyst familiar with Pakistan. "Nobody knows what his allegiance is, in terms of Pakistan's constitution."
President Asif Ali Zardari, elected by parliament six months ago, had feared Chaudhry could wage a vendetta against Musharraf that could also threaten his own position.
Although he has a healthy majority in parliament, Zardari's retreat on the issue will raise questions about his future, and enhance the standing of his main rival, former prime minister Sharif.
Chaudhry will be reinstated on March 21 when the incumbent retires.
Several hundred jubilant lawyers and activists gathered outside Chaudhry's Islamabad residence, which he refused to vacate after his dismissal when Musharraf declared emergency rule in a desperate move to extend his presidency for another term.
They danced and chanted "Long live the chief justice."
"It's the first time in the history of Pakistan that a movement launched by the middle class has proved successful," said retired judge Tariq Mehmud, a lawyers' campaign leader.
Western diplomats had tried to make Zardari pull out of a collision that could have destabilized the year-old civilian coalition and forced a reluctant army chief, General Ashfaq Kayani, to intervene. Kayani was involved in negotiations leading up to the decision to restore the judge.
Sharif, a two-time prime minister with a conservative, religious-nationalist support base, was overthrown by Musharraf in 1999. Since his return from exile in 2007 he has become Pakistan's most popular politician, thanks partly to his stand on the judge.
Sharif was conciliatory, congratulating Zardari and Gilani.
"We have got the fruit of our two-year struggle," Sharif told supporters in Gujranwala town where the protest procession stopped when news came through of the government's decision.
Zardari, widower of assassinated former prime minister Benazir Bhutto, was elected by parliament last September after forcing Musharraf to quit the presidency.
Deeply unpopular, Zardari was further damaged when he broke a promise to Sharif last year to reappoint Chaudhry, though he brought back most other judges axed by Musharraf.
Zardari conceded over Chaudhry after Sharif and the lawyers held a day of protest in Lahore and set off for Islamabad for a sit-in outside parliament.
Authorities had put shipping containers and trucks on roads to stop the protesters from entering the capital.
Sharif latched onto Chaudhry's cause two years ago, but the latest crisis began when Zardari ejected Sharif's party from power in Punjab last month, after the Supreme Court barred Sharif and his younger brother Shahbaz from holding elected office.
Gilani reached out to the Sharifs in his address, saying: "Let's move ahead together with other political powers."
A constitutional package that a government official said was being worked out was expected to include the lifting of central government rule in Punjab, setting the stage for the provincial assembly to elect a chief minister.