Brazil's Court of Appeals has ordered former president Luiz Inacio Lula da Silva remain in prison, reversing a shocking decision by a judge of the same court to free Lula earlier on Sunday.
Judge Sergio Moro, who sent Lula to prison in April on a bribery conviction, said the court lacked the authority to release Brazil's most popular politician.
Lula remains popular in Brazil despite being sentenced a year ago to 12 years in prison for corruption.
Polls suggest the leftist former president would win a third term in the October elections, but Brazilian law prohibits a candidate from running for office for eight years after a criminal conviction.
Da Silva's mass appeal propelled him to two terms as president between 2003 and 2011, a period of strong economic growth.