Pakistan's parliament has voted to approve Yusuf Raza Gillani as the country's new prime minister.
Mr Gillani was the candidate of the Pakistan People's Party that emerged the main winner of the recent polls.
This is the first time in 12 years that the PPP will head the government, a coalition with a substantial majority.
Mr Gillani immediately said he would seek the release of all judges detained after President Pervez Musharraf imposed emergency rule in November.
Dozens of judges were forced out of their posts by Mr Musharraf. Most have since been freed from detention, but former chief justice Iftikhar Chaudhry is among those still under house arrest.
Mr Gillani also said he would seek a resolution calling for a UN investigation into the assassination of former Prime Minister Benazir Bhutto.
The PPP nominated Mr Gillani as its candidate at the weekend.
Mr Musharraf (R) was badly weakened by the February elections
The BBC's Syed Shoaib Hasan in Islamabad says that Mr Gillani is much admired within the PPP. He resisted pressure from President Musharraf to desert the PPP, refusing to do any deals with him.
The former parliamentary speaker went to jail in 2001, serving five years following a conviction over illegal government appointments.
The sentence was passed by an anti-corruption court formed by President Musharraf as part of what he termed measures to cleanse politics.
His opponents say it was a means of intimidating and coercing their members to join his government.
He will be facing token opposition from President Musharraf's allies, who were soundly defeated in recent elections.
He will have the daunting task of holding together a large coalition, tackling Islamic militancy and severe economic problems.
The PPP, which was led by Benazir Bhutto until her assassination in December, emerged as the biggest party in the February elections.
Ms Bhutto's widower is still the PPP's most powerful figure, say analysts
It is now headed by her widower, Asif Ali Zardari.
On Monday he was quoted in The News newspaper as saying that Mr Gillani would serve a full five-year term as prime minister.
There has been widespread speculation that Mr Zardari only wants the next prime minister to hold the post on an interim basis while Mr Zardari takes the necessary steps to make himself eligible to become prime minister.
That would include Mr Zardari winning a parliamentary seat in a by-election.
President Musharraf's power base was badly weakened in the elections.
He earlier sacked the judges because the Supreme Court had been set to rule on whether his re-election as president was legal.