The general returned to detention after the parliamentary session
Defeated Sri Lankan presidential candidate Sarath Fonseka has been released from detention to appear in the opening session of parliament.
The general, who is being court martialled, called for the "rule of law" in an attack on his arch-rival, President Mahinda Rajapaksa.
His comments were his first remarks in public since his detention on 8 February on corruption charges.
He travelled under escort from military custody to take up his seat.
Gen Fonseka fell out with the president after the defeat of Tamil Tigers rebels last May.
He was beaten by Mr Rajapaksa in presidential elections of January 2010.
'Speaking with grief'
"What the country needs is democracy, rule of law, personal freedoms and media freedom," Gen Fonseka told members of parliament attending a swearing-in ceremony for the body's 225 lawmakers.
The general was alongside former cricket captain Arjuna Ranatunga
During the ceremony, he and other party heads were permitted to offer congratulations to its new speaker - Chamal Rajapaksa, the president's brother.
"The protection of democracy must begin here in parliament," he said. "The citizens must have freedom of movement, freedom of expression and freedom from illegal detention."
He said he was speaking "with grief" as he had been arrested under false charges.
The general, who was wearing white, shook the hands of other opposition MPs and waved to the public gallery.
The BBC's Charles Haviland in Colombo says that the government is highly sensitive about him.
Journalists were not allowed to approach him, and state television's report of the opening of parliament ignored his contribution.
The general's leftist Democratic National Alliance (DNA) party won seven seats in the elections of 8 April.
The assembly is dominated by the United People's Freedom Alliance led by the president.
Mr Rajapaksa's coalition is just short of the two-thirds majority required for the government to rewrite the constitution, which bars the president from standing again when his second term ends in 2016.
Gen Fonseka - who won his parliamentary seat while in detention - had been allowed to attend the opening but would be returned to detention afterwards, government officials said.
His court martial, on charges of allegedly engaging in politics while in uniform and involvement in corrupt arms procurement, was adjourned on Tuesday for two weeks.
The general denies all the accusations, saying they are a politically motivated attempt to silence him.
The main opposition United National Party was soundly beaten in the parliamentary elections, winning just 60 seats, while the main Tamil party, the Tamil National Alliance, came third with 14.
On Wednesday, President Rajapaksa appointed DM Jayaratne, a former teacher in his 70s, as prime minister.
Mr Rajapaksa is working out who will be in his new cabinet.