Mr Anwar received an ecstatic welcome
Malaysian opposition leader Anwar Ibrahim has launched his bid to return to parliament.
Mr Anwar was cheered by thousands of supporters as he filed papers to contest a seat in the northern province of Penang.
The opposition alliance headed by Mr Anwar enjoyed unprecedented support in a general election in March.
But he has since been charged with sodomising a male aide - an accusation he says is politically motivated.
In spite of the charge, Mr Anwar has vowed to press ahead with his effort to end the 51-year reign of Malaysia's Barisan Nasional (National Front) coalition.
At least 15,000 of Mr Anwar's supporters escorted him to the nomination office to register his candidacy for the by-election in the semi-urban constituency of Permatang Pauh.
They shouted "reformasi!" ("reform!"), and held aloft banners reading "Road to parliament", reports said.
Some 3,000 police were drafted to ensure there were no clashes with about 4,000 people who had gathered to support the government candidate, Arif Shah Omar.
Mr Anwar, 61, is the favourite to win the Permatang Pauh seat, which he held from 1982 until he was jailed on charges of sodomy and corruption in 1999.
His wife, Wan Azizah Wan Ismail, then stood for and won the seat, recently resigning in order to trigger this by-election and pave the way for her husband's return to formal office.
"I feel good," Mr Anwar told reporters, smiling.
"Barisan Nasional is clearly overwhelmed. It's no longer a by-election. It's more than that," he said.
Deputy Prime Minister Najib Razak admitted the ruling party was the underdog in the contest.
"It is going to be an uphill task but nothing is impossible in politics," he said.
Recent political twists and turns in Malaysia have had a familiar air, correspondents report.
An accusation of sodomy, along with corruption charges, saw Mr Anwar put into jail from 1999 until 2004, when a court overturned the sodomy conviction.
The corruption conviction stood, meaning Mr Anwar was barred from office until April this year - but only two months later he was again accused of homosexual sex, this time with a 23-year-old male aide.
Sodomy, whether consensual or otherwise, is illegal in mostly Muslim Malaysia.
Mr Anwar stoutly rejects the sodomy claims, and says they are a ploy by a ruling party rattled by growing support for his opposition alliance.