Ednaldo Rodrigues, who first took the job as interim president in 2021 after predecessor Rogerio Caboclo was suspended, can still appeal the decision.
The court's ruling on Thursday could ultimately lead FIFA to suspend the Brazilian federation, known as the CBF, and ban its teams, officials and referees from taking part in international games and events.
Magistrates Gabriel Zéfiro, Mauro Martins and Mafalda Lucchese ruled against a deal between the CBF and the state's prosecutors' office allowing then-interim president Rodrigues to run for the job in last year's election.
Some CBF executives have argued Rodrigues could not have signed the agreement because it would benefit himself as a candidate.
The court said in a statement that the CBF will have to elect a new president within 30 days. Until then, the head of the country's sports court, José Perdiz, will be in charge.
CBF spokesman Rodrigo Paiva told The Associated Press the soccer body will wait for advice from its lawyers before making decisions about the case.
Rodrigues' term in office runs through 2026. He is yet another CBF president to face legal problems in recent years, though he is not involved in corruption cases like predecessors Ricardo Teixeira, José Maria Marin and Marco Polo del Nero.
Caboclo was suspended from the presidency in September 2021 in connection with a sexual harassment case at the CBF, which opened the path for vice presidents to elect Rodrigues as the first Black president of the soccer body.
The ruling against the 69-year-old Rodrigues could hurt Brazil's bid to host the Women's World Cup in 2027 and his quest to hire Real Madrid coach Carlo Ancelotti to lead the national team next year.
Rodrigues was at the Mineirao Stadium in Belo Horizonte on Wednesday to give Palmeiras the Brazilian league trophy after the Sao Paulo-based team drew 1-1 with Cruzeiro.