By Paulo Prada

RIO DE JANEIRO (Reuters) - Seven years after a corruption scandal rattled the government of former President Luiz Inacio Lula da Silva, Brazil's Supreme Court on Thursday began a landmark trial that could mar the wildly popular leader's legacy.

Brazilians still don't know the extent of the infamous "mensalão" scandal, an alleged scheme to pay legislators a monthly retainer in exchange for their support in Congress.

If prosecutors get their way, though, they could convict as many as 38 former officials and associates of the ruling Workers' Party, several of whom were senior aides to Lula at the time.

The affair has little bearing on the day-to-day dealings of President Dilma Rousseff, who was hand-picked by Lula to succeed him and won the election with his strong support.

But the trial, expected to last over a month, is being closely watched across Brazil and is the subject of magazine covers, front-page spreads and heated conversations in living rooms, bars and street corners.

At stake is the lustrous legacy of Lula, Brazil's most popular politician. He was sluggish in his initial response to the scandal, defending some of the accused, but is still beloved after an eight-year administration during which Brazil's economy grew by an annual average greater than 4 percent.

Though re-elected for a second term one year after the scandal toppled trusted deputies, details that may emerge during the trial could cast doubt on Lula's longstanding denials that he knew about alleged payments. They could also impact any plans he harbors to return to the presidency, a remote possibility he has acknowledged should Rousseff decide against seeking re-election in 2014.

"If defendants argue that he in fact knew about any payments, it would be a serious stain," said Andre Cesar, a political consultant in the capital, Brasilia.

Controversy immediately swept the trial on the first day as Justice Jose Antonio Dias Toffoli refused to recuse himself from the case despite a public outcry. Toffoli used to be a lawyer in the office of Jose Dirceu - Lula's once-powerful chief of staff and the alleged mastermind of the payment scheme.

A petition calling for Toffoli to step aside circulated on Facebook on Thursday - part of the media sensation accompanying the trial. On Wednesday, citizens in Sao Paulo, Brazil's biggest city, spelled "mensalão" in candles along a central avenue. In Brasilia, security guards in black suits and sunglasses lined the perimeter of the colonnaded Supreme Court building.

A TRIAL 'FOR BRAZILIAN HISTORY'

Corruption is still a major problem in Brazil, from small town councils all the way to the federal Congress, where many lawmakers are experts at back-room deals and often rat each other out to reporters.

More often than not, the country's feisty media unearth scandals before the police. The mensalão only emerged because of muckraking by Veja, a weekly magazine.

Last year, six Rousseff ministers resigned after media linked them to unrelated scandals of their own. The problems complicated Rousseff's relations with Congress, but showed that she, unlike Lula, wouldn't cling to tainted officials.

Now, the mensalão trial is an opportunity for Brazil's courts to show, if not velocity, at least some resolve and institutional progress.

"It's often said that there is no punishment in Brazil," former President Fernando Henrique Cardoso said in a video by his centrist party, the chief opposition to the left-leaning Workers' Party, or PT. "Now we have an important moment, a moment for Brazilian history."

Rousseff herself is quiet about the trial, a convoluted case alleging the use of public funds, and secret Workers' Party finances, to pay for the votes and party causes.

Because it weakened Dirceu, Rousseff's ascent was a direct result of the scandal. Assuming his former post as the president's de-facto prime minister, the former energy minister accrued power that made her the party candidate when Lula faced a legal limit of two consecutive terms.

With plenty of political capital now in her own right -- Rousseff's approval rating reached 77 percent in June -- the president is keeping a safe distance from the ugly trial. Even convictions for former colleagues are unlikely to weaken her, especially because the defendants are now considered relics.

'POLITICAL MARKETING'

The Workers' Party, still the dominant force in Brazilian politics, has been on the attack. After all, the scandal destroyed some of its biggest stars. Dirceu, a party president, its treasurer, and a communications minister all succumbed.

To this day, the party denies that the scheme existed, or that party or public funds were ever illicitly spent. Jilmar Tatto, the party's leader in the lower house of Congress, called the scandal "the biggest piece of political marketing produced in the recent history of Brazil."

The party, and Lula himself, in recent months have been embroiled in a debate over whether the trial should be delayed so it doesn't affect voting in October's municipal elections, important because mayorships are often springboards for federal office. Party lawyers sought to postpone the trial and Lula publicly bickered with a Supreme Court justice after a meeting at which the former president reportedly called the trial's timing "inconvenient."

Lula denied pressuring the judge or asking for any delay.

Rival parties are seizing on the trial to "remind voters of what the PT is," said Jose Agripino Maia, a center-right senator.

Still, some scholars believe the scandal won't necessarily influence future voting. "Voters may be forced to remember, but they won't be forced to analyze and let that impact their vote," said David Fleischer, a professor of political science at the University of Brasilia.

(Additional reporting by Jeferson Ribeiro, Ana Flor and Hugo Bachega in Brasilia; Editing by Todd Benson and Kieran Murray)