Pakistan's 25th Chief Justice retired on Thursday after a controversial two-year tenure which will be remembered for his self-admitted judicial activism that earned him criticism for encroaching on the executive powers.

Mian Saqib Nisar, 64, was appointed the head of the Supreme Court in December 2016 and came with a great reputation as a jurist, and presided over a tenure often termed "populist" amid constant media attention.

Like a politician, the top judge travelled across the country followed by TV cameras, making a sudden visit to hospitals in Lahore, where he criticized dirty utensils and grabbing attention for acts like giving his phone to the father of a murdered girl, telling him to call if he had complaints against the police investigations.

In April, he refused to accept his salary until the payment of the employees of the waterworks department - stuck for some time - was released.

His pet project was a crowdfunding campaign to collect $14 billion for the construction of two dams in the northeastern part of the country - hit by lack of funds and a growing water crisis - a process that will continue after his retirement.

Nisar was known for taking suo moto cognizance of cases, especially in matters related to water quality, pollution, excessive population growth and killings of minors.

"The aim of my struggle is clean air, clean water, pure milk," the judge told a group of lawyers in Islamabad in February last year.

In one of his most controversial decisions, a four-member judge, including Nisar, disqualified Nawaz Sharif as the prime minister in July 2017 for not declaring income he received from a company owned by his son.

Sharif, who is serving a jail term on corruption charges, lashed out against the top judge for "the worst kind of dictatorship under Saqib Nisar".

Unperturbed, Nisar and the Supreme court charged politicians who openly criticized them with contempt, even sentencing some of them, such as former lawmaker Nehal Hasmhi, who was given a one-month prison.

The judge also headed the bench which acquitted Christian woman Asia Bibi - who was on death row since 2009 - on blasphemy charges, a verdict which led to violent protests and extremists calling for his death.

"I tried to return the respect given by the people and tried to solve the issues plaguing sectors of health and education, both of which are rights granted to citizens by the constitution," Nisar said in his farewell speech.

His successor Asif Saeed Khosa, who is set to take charge on Friday, has already announced he would take suo moto cognizance only as a last resort in limited number of cases and joked about copying Nisar in building dams and reducing debt.

"Dams against frivolous litigation and (will also try) to retire a debt, the debt of pending cases," Khosa said while bidding farewell to his predecessor, referring to the 1.9 million unresolved cases pending in Pakistani courts.

By Jaime Leon