Opposition leader Anwar Ibrahim said he was confident of winning a critical by-election despite what he has called a government dirty-tricks campaign to undermine him.

In a last-ditch bid for votes before a midnight curb on campaigning, Anwar held a huge gathering tonight that drew some 10,000 people by late evening with many more streaming in despite drizzling rain.

One of those who attended the mammoth rally, Roslan Ismail, 33, said he was undeterred by the personality attacks against the opposition leader.

"It is all Barisan Nasional propaganda. We will vote for Anwar, God willing, he will become the prime minister," he said after crossing a six-lane highway to reach the rally site with his wife and three young children.

The opposition has accused the ruling BN coalition of buying votes and stoking racial tensions in an effort to sideline Anwar, who is bidding to return to parliament in a step towards seizing power.

anwar yayasan aman pc 250808 03 "It shows the level of desperation and abuse of power by the Barisan Nasional," Anwar said of the bitter campaign for Tuesday's vote, and the government's focus on sodomy charges levelled against him by a young male aide.

"I am confident, God willing, we will win, but we are fighting an entire government machinery which has spent millions of dollars in an attempt to deny me a victory," he said.

The charismatic 61-year-old, who was sacked as deputy premier in 1998 and spent six years in jail on sodomy and corruption charges, said he was still on track to unseat the government by mid-September with the help of defectors.

"Yes, there are MPs in the ruling party that have expressed support for me," he told a press conference.

anwar ibrahim permatang pauh by election ceramah 220808 01 The Merdeka Centre research firm said Anwar was likely to claim victory in the Permatang Pauh electorate in his home state of Penang, but that the new sexual misconduct accusations were a factor in the campaign.

"I think Anwar will win," said the centre's pollster Ibrahim Suffian.

"The issue of the sodomy allegations, while it gained some traction at the beginning of the campaign, by the end had reached saturation point and won't significantly affect his chances of winning," he told AFP .

4,500 police were on duty

With both sides trading allegations of misdeeds and attacks on supporters, the mood was tense in Permatang Pauh, where some 4,500 police were on duty, and riot squad officers patrolled in trucks and on motorcycles.

In the skies above its townships and paddy fields, a police helicopter hovered, keeping a close watch on Anwar's rallies, which have attracted thousands and created massive traffic jams along the narrow rural roads.

umno bn pak lah liow tiong lai event permatang pauh by election 240808 05 A Merdeka Centre poll found voters were most concerned over Malaysia's faltering economy, and that 59 percent believed the sexual misconduct allegations were politically motivated.

His original sodomy conviction was overturned in 2004 by the nation's highest court, but the corruption count still stands, preventing him from running for office until April this year.

Although most pundits expect Anwar to claim victory, the size of his winning margin will be seen as an indicator of his ability to overcome the accusations and be an effective leader of an unwieldy three-member opposition alliance.

After the March elections that handed the alliance control of five states and a third of parliamentary seats, he has to persuade 30 government lawmakers to switch sides in order to seize power.

He also needs to show he can continue to command support from across the racial spectrum in Malaysia, whose population is dominated by Malays but also includes large ethnic Chinese and Indian communities.

I voted for Azizah, I'll vote for Anwar

permatang pauh election results 310708 Anwar, who looked fresh but said he was "exhausted" by the intense 10-day campaign, said he expected to lose some votes due to the government's bare-knuckle tactics.

"If you look at the ground support, it is extremely good but we have to make sure there is no cheating," he said.

PKR vice-president R Sivarasa raised concerns that a new electoral roll had been rigged, saying that hundreds of voters' names had been removed while hundreds of others were added.

"The Election Commission has never been known to be independent," he said. "It is an attempt to remove our voters and put in Barisan Nasional voters."

The opposition has accused the Barisan Nasional coalition - which has ruled for half a century - of painting Anwar as a "Chinese agent" who has sold out the interests of Malays in his pursuit of power.

But on the streets of Permatang Pauh most people of all races said they favoured Anwar, who is running against Arif Shah Omar Shah from Umno which leads the coalition.

"I voted for Wan Azizah, I will vote for Anwar Ibrahim because I want the Barisan Nasional to be toppled," said Ahmad Zawawi, a food vendor. "We want a new leadership - 51 years is enough."

However Deputy Prime Minister Najib Razak, who has campaigned heavily for the government, defied the pundits and said he was convinced the public had lost faith in Anwar.

"When I began the campaign, political analysts predicted that BN has no hope, but after almost two weeks there are signs that victory is in the hands of BN," he said during a visit to an opposition stronghold.

Watch 18-min of Anwar's press conference

Permatang Pauh: Mother of all by-elections