Brazil’s Worker’s Party (PT) have formally registered jailed former President Luis Inacio Lula da Silva as their presidential candidate.
Supporters chanted “Lula for President” and “Free Lula” as they followed PT members to the electoral court in Brasilia hours before the deadline.
But the ex-president will likely be barred from running after his conviction was upheld in January.
Lula is currently serving a 12-year jail term for accepting a bribe.
He was convicted of receiving a renovated beachfront apartment worth some 3.7m reais ($1.1m; £790,000) as a bribe by engineering firm OAS.
He denied wrongdoing and said his conviction was part of a plot to prevent him returning to power.
The former president is the most high-profile person convicted in the sweeping Operation Car Wash anti-corruption investigation.
Police say 10,000 people took part in the march to the Brasilia court house.
Despite his jail sentence, the PT voted to nominate Lula as their candidate earlier this month.
Lula has reportedly chosen Fernando Haddad, former mayor of Sao Paulo, to run for the PT when he is likely prevented from doing so.
Serving as president from 2003 to 2011, Lula presided over a surge in economic growth and major social programmes that left him with an 87% approval rating on leaving office.
But the former leader surrendered to police in April after his bribery conviction.
An appeal in January not only saw the court uphold his original conviction, but also increase the length of the sentence by two-and-a-half years.
While the ex-president is still waiting for a final court judgement on whether he can run, under current law someone who loses an appeal against a criminal conviction cannot stand for the presidency.
Despite this, polls reportedly show around one third of Brazilians would back Lula if he were allowed to run, which would make him the front-runner in October’s vote.