Former Brazilian president Luiz Inacio Lula da Silva has spent his first night in jail on a corruption conviction. 

He turned himself into police earlier, ending a day-long standoff to begin serving a 12-year prison sentence for corruption that derails his bid to return to power.

Lula was flown by police to the southern city of Curitiba, where he was tried and convicted late last year, and taken to the federal police headquarters there to serve his sentence.

Protesters supporting Lula clashed with police outside the walls of the building.

Officers used stun grenades, tear gas and rubber bullets to disperse the crowd.

In a fiery speech hours earlier to a crowd of supporters of his Workers Party outside the union building in Sao Paulo, Brazil's first working class president insisted on his innocence and called his bribery conviction a political crime, but said he would turn himself in.

"I will comply with the order," he told the cheering crowd. "I'm not above the law. If I didn't believe in the law, I wouldn't have started a political party. I would have started a revolution."

Lula, who faces six more trials on corruption charges, finally ended the standoff when he moved out in a convoy of black police SUVs after pushing his way out of the steel workers union headquarters where he had taken refuge.

He entered police custody more than 24 hours after a court deadline on Friday afternoon.

Lula's imprisonment removes Brazil's most influential political figure and front-runner from this year's presidential campaign, throwing the race wide open and strengthening the odds of a more centrist candidate prevailing, according to analysts and political opponents.

It also marks the end of an era for Brazil's left, which was out in force in the streets outside of the union headquarters in the industrial suburb of Sao Paulo where Lula's political career began four decades ago as a union organiser.

The crowds of supporters, which began gathering when he arrived late on Thursday night, dissuaded police from trying to take him into custody and heightened concerns about a violent showdown.

Supporters blocked Lula's first attempt to leave the union building yesterday afternoon, pushing back against fellow party members trying to open the gate for his car to leave.

Workers Party chief Gleisi Hoffmann pleaded with supporters to let him exit.

Lula was convicted of taking bribes, including renovation of a three-story seaside apartment that he denies ever owning, from an engineering firm in return for help landing public contracts.

"I'm the only person being prosecuted over an apartment that isn't mine," insisted Lula, standing on a sound truck alongside his impeached handpicked successor Dilma Rousseff and leaders of other left-wing parties.

A Brazilian Supreme Court justice yesterday rejected the latest plea by Lula's legal team, which argued they had not exhausted procedural appeals when a judge issued the order to turn himself in.

Under Brazilian electoral law, a candidate is forbidden from running for office for eight years after being found guilty of a crime.

Rare exceptions have been made in the past, and the final decision would be made by the top electoral court if and when Lula officially files to be a candidate.