The controversial career of Pakistani Chief Justice Iftikhar Chaudhry in some respects mirrors that of two of the country's leading politicians.
Like President Aif Ali Zardari and opposition leader Nawaz Sharif - imprisoned and self-exiled respectively in the course of their careers - Mr Chaudhry made a dramatic return to his position as the country's top judicial job in 2009 after being unceremoniously sacked two years years earlier.
Pakistan's top lawyer has form when it comes to opposing the sitting government.
He was one of several judges sacked by President Musharraf after they questioned his right to remain in office. He was reinstated following a long series of street marches in which tens of thousands of people - including many fellow lawyers - rallied around him in a movement that ultimately led to the ousting of Mr Musharraf.
For a time after his reappointment Mr Chaudhry enjoyed a strong populist image, seen as a champion of the rule of law and praised as the only judge in history to have stood up to a military ruler and won.
But in June 2012 he was put in the embarrassing position of having to exclude himself from the bench hearing allegations of corruption made by a business tycoon against his son, Arsalan.
The chief justice initiated the case as a response to accusations that Arsalan had accepted millions of dollars in bribes. Both he and his son deny any wrong-doing.
Mr Chaudhry has long been criticised for being selective in the cases he pursues. President Zardari has accused him of relentlessly pursuing the government in relation to contempt of court proceedings against Prime Minister Yousuf Raza Gilani - while being lukewarm in pursuit of the killers of his wife, Benazir Bhutto, in 2007.
The Supreme Court which he heads has historically given legitimacy to military coups. Some argue that the chief justice also dragged his feet over corruption allegations against the intelligence services while doggedly pursuing different corruption cases against the government.
In a landmark ruling in 2009, however, he said that the judiciary would no longer give legal backing to power seizures by the military.
Many believe that the Supreme Court led by Mr Chaudhry nevertheless still enjoys the tacit support of the military, which has been happy to let it do the work of challenging the government.
The BBC's M Ilyas Khan in Islamabad says that in-fighting between Pakistan's various institutions of state has destabilised the country's nascent democratic set-up and further tainted its largely mistrusted legal system.
Yet despite the squabbling and allegations of partisanship, Chief Justice Chaudhry is still considered by many to be the symbol of justice, rule of law and democracy.
His role at the centre of Pakistan's complicated power structure is a far cry from his earlier background.
Iftikhar Chaudhry was born to a lower middle class family in the western city of Quetta in 1948. He studied law at the local university and started a legal practice in Quetta in 1974.
He tried his hand in many fields of the law - civil, criminal, tax, revenue and, later, constitutional - and qualified for legal practice at the Supreme Court in 1985.
In 1989, the Balochistan provincial government appointed him as its advocate general, and the next year he became a judge of the Balochistan High Court.
He became the chief justice of Balochistan in April 1999 and was elevated to the Supreme Court of Pakistan in February 2000. On June 30 2005 he was appointed the chief justice of Pakistan.
During this period, Justice Chaudhry did not betray any signs of breaking with the past traditions in order to chart an independent course for himself.
He sat on four pivotal Supreme Court benches between 2000 and 2005 that validated the military takeover by Gen Musharraf, his referendum, his legal framework order (LFO) and the 17th constitutional amendment that gave the president additional powers and allowed him to continue as the army chief.
Although Justice Chaudhry voted with the majority on each bench, he did not head any of them.
However, after becoming the country's youngest chief justice, he became eager to secure the independence of the Supreme Court and showed a lot of energy in working overtime to clear the backlog of cases.
He established a separate human rights cell at the court for cases involving so-called honour crimes.
He also took on the government and the military, forcing the intelligence agencies to admit they held dozens of people in secret custody.
Getting the administrative and policing system to deliver in such cases often necessitated harsh handling of officials in the court.
He grew increasingly unpopular with those officials, but became the darling of human rights groups whose activists came out in large numbers to support him when he was suspended by President Musharraf.
Observers believe that two factors played a decisive role in elevating him from the realm of the ordinary to that of a hero.
First was the TV image of the judge defiantly resisting reprimands for alleged misconduct by President Musharraf, who at that time was becoming an increasingly unpopular military ruler.
The second was his courage in refusing to step down as a result of this pressure.
The dominant theme of the proceedings - then as now - was of a judge at the centre of a hard-fought and often bitter power struggle between Pakistan's institutions of state.