Gilani is expected to challenge many of Musharraf's most controversial policies [AFP]
Three months after the assassination of Benazir Bhutto, the leader of the Pakistan Peoples Party (PPP), Yousaf Raza Gilani, her long time supporter, was elected as Pakistan's prime minister.
It was the first time the party held power with anyone other than Bhutto as prime minister.
He took up the premiership, leading a coalition government dominated by his party and Nawaz Sharif's Pakistan Muslim League (PML-N), with popular expectation that he would challenge many of the policies imposed by Pervez Musharraf, then Pakistan's president.
His first action in office was to order the release of judges detained by Musharraf under a brief period of emergency rule in 2007.
Born on June 9, 1952, in Karachi, Gilani comes from a family of prominent landowners and spiritual leaders in Multan, in the south of Punjab province.
His grandfather and grand-uncles were members of the All India Muslim League, and signed the 1940 Pakistan resolution that led to partition of British-ruled India.
His father was a provincial minister in the 1950s.
Gilani joined the Muslim League's central leadership in 1978, after completing a graduate degree in journalism at the University of Punjab.
In 1983, he was elected chairman of the Multan union council, and by 1985, he had become a member of parliament.
After being sidelined in the party, Gilani switched allegiances in 1988 to then-opposition PPP and won the seat of chief minister of Punjab from Nawaz Sharif.
Serving as speaker of parliament during the PPP's 1993-1996 rule, he lost re-election in 1997.
In 2001, he was jailed by Musharraf and served five years on charges of making illegal appointments as parliament speaker.
Gilani argues that the charges were meant to pressure him to leave the PPP and join Musharraf's government. He was exonerated and freed in 2006.
While in prison, Gilani wrote a book that advocates a strong military, but one that is removed from politics.
He has called for the repeal of constitutional changes made by Musharraf, including the power to dismiss a government. The PPP-led coalition he now leads nearly has the two-thirds majority in parliament that is needed to amend the constitution.
Ahsan Iqbal, a legislator in the coalition government, said: "Mr Gilani is a man who suffered from Musharraf's martial law. He understands well that getting rid of dictatorship is important."
Analysts said Gilani's record and treatment at the hands of Musharraf made him a good pick to straddle the rivalry and ideological differences inside the coalition - which included religious and ethnic Pashtun parties, as well as the country's main centre-left and centre-right parties.
Gilani's election also helped the PPP offset Sharif's popularity in the Punjab.
Pakistan's most populous province, Punjab has a reputation for making or breaking governments and saw a swing to the PML-N in the February 18 vote that prompted the formation of Gilani's coalition government.
Ultimately, though, Sharif's PML-N party pulled out of the coalition over differences with the PPP.
At the time of Gilani's election there was intense speculation that Gilani would serve only as a stop-gap prime minister until Asif Ali Zardari, Bhutto's widower, who took up the leadership of the PPP after her death, could take over.