Malaysia's prime minister-in-waiting Anwar Ibrahim will contest a by-election that is expected to pave the way for his return to active politics, officials said Wednesday.

Lawmaker Danyal Balagopal Abdullah said he has resigned as a member of Parliament in Port Dickson, a southern coastal town, to make way for Anwar's comeback. The Election Commission must set a date for the by-election within two months.

Anwar, 70, is the anointed successor to Prime Minister Mahathir Mohamad. The two had a power struggle 20 years ago that led to Anwar's sacking and imprisonment. Anwar was convicted again in 2015 on the same charge of sodomy but joined hands with Mahathir to win national elections in May that ushered in the first transition of power since independence from Britain in 1957.

He was freed from prison and pardoned by the king after the elections.

Domestic Trade Minister Saifuddin Nasution, who is a senior official in Anwar's party, said there is no timeframe for Anwar to take over the top job and that Anwar has reiterated that he will give his full support to Mahathir.

"He has stated clearly that if he wins as a member of Parliament, he will focus on parliamentary reforms. He will not hold any government positions," Saifuddin told a news conference.

Anwar has previously said he wasn't in a rush to take over as prime minister and that he will not interfere with Mahathir's governance.

Mahathir, who is the world's oldest leader at 93, told The Associated Press In an interview last month that he expects to be in office for at least two years and will keep his promise to hand over power to Anwar.

Anwar was once a high-flyer in the former ruling coalition but was convicted of homosexual sodomy and corruption after a power struggle in 1998 with Mahathir, who was prime minister for 22 years until 2003. He was freed in 2004 and convicted again in 2015 of sodomy, which he said was concocted to destroy his political career.

Anwar worked from his prison cell to forge a new opposition alliance by ending his two-decade feud with Mahathir, a gamble that paid off when the alliance won the polls.