It was not easy for jailed opposition leader Anwar Ibrahim to accept Dr Mahathir Mohamad as Pakatan Harapan's premiership candidate.

In his speech at the Harapan convention today, Mahathir, who was officially named as the opposition PM candidate, said he was indebted to Anwar.

The former premier also noted that some in the opposition were still not comfortable with his past actions.

"I realise how Anwar feels, particularly when he was sent to Sungai Buloh (prison) during my time. It is not easy for him to accept me (as the PM candidate).

"Yes, we shook hands, but it is not easy to accept me, as I was part of the leadership in Umno," he said.

"That's why we took time (to finalise the issue of the candidate), but finally, (he) prioritised the struggle (of Harapan)," he said.

Similarly, he said, Anwar's family members felt the same and suffered in the past 20 years.

"I am very much indebted to Anwar and thank him for being willing to work with the team, including me to save the country," he said to a huge cheer from the crowd.

Mahathir had sacked Anwar, his then deputy back in Sept 1998, and later had him jailed for sodomy, which sparked the reformasi movement and formation of Anwar's party PKR.