Brazil's former president Luiz Inacio Lula da Silva has been convicted of corruption and money laundering and sentenced to nine-and-a-half years in jail.
Silva will remain free while an appeal is heard.
Silva was accused of receiving a beachfront apartment as a bribe from construction company OAS. Prosecutors also alleged OAS did repairs to the apartment and paid to store Silva's belongings.
The former president has said the charges are completely unfounded.
The case is part of a massive corruption investigation that has engulfed Brazilian politics and seen business executives and elite politicians jailed.
"The present conviction does not bring this judge any personal satisfaction. Quite the contrary, it is regrettable that a former president be criminally convicted," federal Judge Sergio Moro wrote in his decision.
"It doesn't matter how high you are, the law is still above you."
Judge Moro said he did not order Silva's immediate arrest because the conviction of a president is such a serious matter that he felt an appeal should be heard first.
Silva, who was president between 2003 and 2010, is leading polls for next year's presidential election.
The case will now be heard by a group of magistrates. If they uphold the conviction, Brazilian law says that Silva would be barred from seeking office.