Brazil's Supreme Court ruled on Thursday to take a corruption investigation into former president Luiz Inacio Lula da Silva away from a crusading federal judge, as pro-government protests across the country eased pressure on President Dilma Rousseff.

Local television showed tens of thousands of supporters clad in red marching for Rousseff, who has faced growing calls for her impeachment since anti-corruption judge Sergio Moro released a wiretapped conversation of her and Lula this month.

Thursday's 8-2 Supreme Court decision grants Lula and Rousseff a breather from Moro by putting Lula's case temporarily in the hands of the top court, all but 3 of whose members have been named since the ruling Workers' Party took office in 2003.

Lula, Rousseff's predecessor and mentor, is under investigation for allegedly benefiting, in the form of payments and a luxury apartment, from a massive graft scheme uncovered at state-run oil company Petrobras.

Rousseff is fighting impeachment over unrelated charges of irregularities in the government budget designed to favor her reelection in 2014. She could lose power as soon as May if she does not gain more support in Congress.

The corruption scandal, Rousseff's Congressional weakness and a deepening economic recession have led to Brazil's worst political crisis since former President Fernando Collor de Mello resigned to avoid impeachment in 1992.

Up to three million people joined a protest in favor of her ouster on March 13, the largest demonstration in decades.

On Thursday, Rousseff held a rally with artists and movie stars who support her and said opponents trying to impeach her were merely trying to "give a democratic tint to a coup."

Aides said her government had had some success in drawing lawmakers from smaller political parties into her government's alliance, which was shattered by the departure this month of Brazil's largest political party the Brazilian Democratic Movement Party (PMDB).

"The reconfiguration of the base is ongoing," Rousseff's spokesman Edinho Silva told journalists.

In a sign of a potential split among the PMDB, Senate leader Renan Calheiros said his party's decision to leave the government was "foolish" and "premature."

The lower house of Congress is due to vote in mid-April on whether Rousseff should stand trial in the Senate for manipulating government accounts. She is not being investigated for corruption.

Her woes deepened, however, when she tried to appoint Lula to her Cabinet, which would give him some immunity from prosecution because ministers and elected officials can only be tried by the Supreme Court in Brazil.

Hours after he was named, Moro released a recording of them discussing the appointment. A Supreme Court justice suspended Lula's appointment arguing that it was aimed at illegally shielding him.

On Thursday, the Supreme Court overruled Moro's decision to release the recording of his call with Rousseff and said it was the only court authorized to wiretap a conversation involving the president. Several justices said the conversation should not be accepted as valid evidence when the court eventually makes a decision on whether Lula can join the cabinet.

Moro could still take some parts of the Lula investigation, depending on future Supreme Court rulings and whether Lula is ultimately allowed to become a minister.

Lula released a video on social media praising Thursday's protests and gathering of artists, saying the "anti-coup" movement was growing.