Anwar Ibrahim has stressed that there must be a consensus with regard to naming Pakatan Harapan's prime minister candidate.

The jailed opposition leader said this when asked on his former nemesis, Dr Mahathir Mohamad, stating he would consider becoming prime minister again if the opposition coalition wants him to.

"It is not for him (to decide), it is for Harapan (to decide).

"People don't volunteer (to be prime minister), there has to be a consensus," Anwar said when met on the sidelines of a court hearing in Shah Alam this morning.

The PKR de facto leader is the majority of Harapan's choice for prime minister.

However, his incarceration complicates matters because even though Anwar could be freed as early as next year, in the absence of a pardon, his conviction bars him from contesting in an election for five years.

In a live Facebook session last week, Mahathir admitted he might be forced to consider becoming prime minister again if Harapan has such a plan for him in the coming general election.

"I cannot ignore my friends in the Harapan coalition. If they have such a plan and it is agreed upon, I may be forced to consider," said the Parti Pribumi Bersatu Malaysia chairperson.

It was the first time the former prime minister had softened his stance despite repeatedly stressing that he did not even want to contest in the next general election.

Despite his reluctance, calls for him to take up the post of prime minister again continue to be made, with a Malaysiakini poll seeing a majority in favour of such a move.

A poll by PKR-linked research body Invoke also saw Mahathir come out as the second most popular Harapan choice for prime minister, after Anwar.

Harapan leaders have been reluctant to comment on the possibility of making Mahathir prime minister again.