Temer was accused on Thursday of leading a sophisticated embezzlement and money laundering scheme. The Brazilian federal prosecutor's office said it would appeal the decision to free the former president.
A Brazilian appeals court judge on Monday released former President Michel Temer from jail following his high-profile arrest on graft charges last week, which marked a fresh landmark in the country's battle against political corruption.
Federal prosecutors have accused Temer, who was president from 2016 to 2018, of leading a "criminal organisation" that had received or arranged up to $472 million in bribes through various kickback schemes.
He has denied any wrongdoing and his lawyers appealed for his release, arguing that he could be tried while free. He left the federal police station where he had been held in downtown Rio de Janeiro on Monday evening to cries of "thief" from protesters.
Judge Ivan Athie of the TRF-2 federal appeals court said in his ruling that the evidence provided by investigators did not justify the "preventive" jailing of Temer and seven other defendants, including former minister Wellington Moreira Franco.
"You have here old facts, involving possibly illegal acts, but no evidence of repeated criminality after 2016 or any other factor that justifies preventive imprisonment," wrote Athie.
The federal prosecutor's office said in a statement it would appeal the judge's decision, and hoped its request would be heard by the full bench of the appeals court on Wednesday.
Temer's lawyer, Eduardo Carnelos, praised Athie's decision and criticised prosecutors who, he said in a statement, "violate the most vicious notions of law, and vilify the honour of honest people to deprive them of their freedoms."
Former government minister Moreira Franco and seven other people who had been arrested as part of the probe were also ordered freed by Athie.
Brazil's sweeping "Car Wash" probe has uncovered what US prosecutors called the world's largest graft scheme, starting with political bribery involving state-run oil company Petroleo Brasileiro SA and spreading to other sectors and public works.
Over 150 powerful politicians and businessmen have been convicted in connection to the investigation since 2014, which has reshaped the country's political and business landscapes.
Temer is the second former president to be arrested in the anti-corruption push.
Former President Luiz Inacio Lula da Silva is in jail serving over 12 years for a corruption conviction.
Voters' anger over long-running graft fueled the ascent of President Jair Bolsonaro, a far-right politician who served 30 years as a fringe lawmaker, but rose to power on the back of pledges to end graft in the capital Brasilia.
The arrest of Temer on Thursday had added to a selloff in Brazilian financial markets last week, stirring concerns that the case could distract Congress from major economic reforms.
The Bovespa stock index erased losses on the news of Temer's release, trading in line with Friday's close.
Brazil's real jumped 1.4 percent and posted its biggest one-day gain in nearly three months.