Mr Anwar says he will oust the prime minister through MP "defections"
The Malaysian opposition leader Anwar Ibrahim has been sworn in as a member of parliament, ending an absence of nearly a decade.
"I feel vindicated. I feel great that I am back," Mr Anwar told reporters after the ceremony.
But only hours later Mr Anwar led a dramatic walk-out of parliament, in protest at a bill he says targets him.
Mr Anwar recorded a sweeping victory in a by-election on Tuesday, despite facing fresh accusations of sodomy.
He has consistently denied the charges, which he says are politically motivated.
Wearing a traditional dark blue Malay dress and black cap, the 61-year-old politician was sworn in at a simple ceremony at Malaysia's Parliament House.
He was greeted with applause from the opposition benches, which were almost full, as he entered parliament's main chamber, reported the Reuters news agency.
Benches occupied by the governing Barisan Nasional coalition were less than half full.
But only hours after he was sworn in, Mr Anwar led a group of opposition lawmakers out of the chamber, in protest at a government bill.
The bill seeks to require criminal suspects to provide mandatory DNA samples - something Mr Anwar says is targeted at him, as he refused to provide such a sample following his recent arrest.
Mr Anwar, who heads the People's Justice Party, won a landslide victory in northern Penang state on Tuesday.
Correspondents said he had been expected to win but the level of support for him was substantial.
The high turnout saw him winning 31,195 of 47,000 votes, almost double the votes garnered by his opponent.
He has been trying to make his political comeback since a ban on seeking public office, related to a previous corruption conviction, expired in April.
Mr Anwar has pledged to oust Prime Minister Abdullah Badawi, who has faced calls to quit since March elections which saw the opposition gaining ground.
He said that his deadline to secure enough defectors from the government to overthrown Mr Abdullah by 16 September was still on.
"The prime minister has lost the mandate of the country and the nation," he said.
The governing coalition currently holds 140 seats in the 222-seat parliament. Mr Anwar's coalition, Pakatan Rakyat, made up of three parties, holds 82 seats.
He needs to persuade 30 government MPs to defect.
But he faces fresh accusations of sodomy, which is a serious offence in predominantly Muslim Malaysia.
Previous charges of sodomy charges were overturned by a court in 2004 resulting in Mr Anwar's release from jail after serving six years imprisonment.
He denies all the allegations, which he says are politically motivated.