Cast into the political wilderness 15 years ago by Malaysia’s regime, Anwar Ibrahim faces his best and possibly last shot at vengeance in climactic elections on Sunday.

The former heir-apparent to the ruling United Malays National Organisation (UMNO) is today its most feared enemy, having galvanised a diverse opposition that now dreams of unseating one of the world’s longest-serving governments.

“I can be crazy in some ways, partly because I have gone through a lot,” Anwar, 65, said.

“But I just want to prove that you can run the country with good governance, eliminate corruption... and make Malaysia a mature democracy.”

UMNO has towered over the moderate Muslim country through a coalition government since independence from Britain in 1957, but faces rising pressure over corruption and authoritarian tactics.

Much of the credit for the changing landscape goes to the mercurial Anwar, whose charisma, oratorical skills and appeal across multi-ethnic Malaysia’s racial lines breathed life into a once-hapless opposition.

His three-party Pakatan Rakyat (People’s Pact) faces a formidable, dug-in foe, yet many analysts say the result is too close to call.

An opposition victory would cap a remarkable journey for Anwar, whose chameleon career has transformed Malaysian politics.

He was an Islamic student leader whose natural political skills caught the eye of authoritarian former premier Mahathir Mohamad, who dominated Malaysia for 22 years and fast-tracked Anwar to the top.

Morphing into a reformist who was lionised in the West, Anwar looked set to succeed Mahathir.

But a 1998 power struggle between them, in which Anwar criticised cronyism and graft, saw him unceremoniously sacked and later jailed on sodomy and corruption charges widely seen as politically motivated.

His appearance in court with a black eye triggered global opprobrium and unprecedented anti-government protests in Malaysia, deeply polarising its politics.

“The groundswell in Malaysian society today is a direct result. Many people became disillusioned,” said Ooi Kee Beng of the Institute of Southeast Asian Studies in Singapore.

Anwar says he was kept in solitary confinement, singing 1960s pop tunes to stay sane and reading the Koran, the Bible, Shakespeare - anything he could get.

Released in 2004 when the sodomy charge was overturned, he later led the opposition to its best showing ever in 2008 polls, taking more than a third of parliament.

His personal travails continued, however - he was acquitted last year of new sodomy charges after a lengthy legal battle he condemned as another UMNO bid to wreck his comeback.

Now in the clear, Anwar predicts victory and sweeping change for Malaysia.

He has pledged to root out rampant graft, free government-controlled traditional media and reform policies that give advantages to Malays but are criticised as a drag on the economy and a source of racial resentment.

A former finance minister, he advocates populist social and economic policies savaged by UMNO as fiscally irresponsible.

He insists, however, that attacking corruption and curbing illicit money outflows from Malaysia - which total billions of dollars a year, according to watchdog groups - will fund its agenda.

“Just by being transparent, we can achieve our goals,” he said.

But Anwar also vows to step aside as leader if the opposition fails to take power.

Pakatan includes Anwar’s diverse party, a secular one led by ethnic Chinese, and a conservative Islamic party representing the largest demographic, Muslim Malays. The latter’s support for Islamic law has caused frictions.

Anwar’s departure would leave the alliance with no central unifying figure, but he says “there is no indispensable person”.

“People have to accept that I have given all that I have. I have given a lot of my personal life and suffered immensely.”