* Vote against leftist Lula likely ends his political career
* Supreme Court case casts shadow over October election
* Brazil deeply divided after President Rousseff's 2016 removal (Updates text and headline with final vote concluded)
BRASILIA, April 4 (Reuters) - Brazil's Supreme Court early on Thursday rejected former president Luiz Inacio Lula da Silva's plea to avoid prison while he appeals a corruption conviction, in a vote that likely ends his political career and deepens divisions in the country.
The pivotal vote was cast by Justice Rosa Weber against Lula's request to avoid jail and begin serving his 12-year sentence for accepting bribes. Weber was seen as the only swing vote and her decision sealed Lula's fate. He may be jailed within a week.
Lula is still Brazil's most popular politician, despite his conviction and six separate pending corruption trials. He is the front-runner in all opinion polls for the presidential election in October, but his conviction will likely bar him from running.
The decision against Lula is a serious blow to the political survival of Brazil's first working-class president whose career from a factory shop floor to high office is sinking in the corruption scandals that have rocked the political establishment and especially his Workers Party, which held power from 2003 until mid-2016.
Brazilian society remains deeply divided after Lula's successor, President Dilma Rousseff, was impeached and removed from office amid a corruption scandal and economic crisis.
Lula's conviction was upheld on a first appeal. Under Brazilian electoral law, a candidate is forbidden from running for elected office for eight years after being found guilty of a crime. Some exemptions have been made in the past, and the ultimate decision in Lula's case would be made by the top electoral court if and when Lula officially files to be a candidate.
Lower court judges, the country's top prosecutor and business groups urged the court to abide by its own 2016 ruling that defendants can be jailed if a conviction is upheld on a first appeal, as Lula's was earlier this year.
Before that ruling, appeals in Brazil's complex and badly backlogged legal system could stretched out for several years, guaranteeing impunity for those rich enough to afford lawyers who could launch countless technical appeals.
MILITARY WEIGHS IN
Tensions increased on Tuesday when the commander of Brazil's army weighed in with tweets calling on the court to stand guard against impunity. That rattled nerves across Brazil, which endured a 1964-85 military dictatorships and has a long history of coups interrupting democratic regimes.
General Eduardo Villas Boas wrote that the army along with "all good citizens, repudiates impunity and respects the Constitution, social peace and democracy."
Villas Boas wrote that the army would stick to its constitutional role. But retired officers have warned that the military would not take lightly to the Supreme Court, which has rejected nearly all similar appeals in the past two years, ruling that Lula could remain free on appeal.
Army reserve general Luiz Lessa told the Estado de S.Paulo newspaper on Tuesday the military would have to intervene if Lula was allowed to become a candidate in the election. The army said that was his personal opinion.
Lula oversaw years of robust growth and falling inequality during a commodity boom and has said he wants to run again for the presidency in October.
His supporters see the conviction as a ploy to stop him returning to power. The Workers Party said the Army commander's comments widely reported by Brazilian media had brought undue pressure to bear on the Supreme Court to rule against him.
Lula was found guilty in August and sentenced to 10 years in prison for accepting bribes worth 3.7 million reais ($1 million) from engineering firm OAS, the amount of money prosecutors said OAS spent refurbishing a beach apartment for Lula in return for his help winning contracts with state-run oil company Petroleo Brasileiro.
In January, an appeals court unanimously upheld his conviction and increased the prison sentence to 12 years. (Reporting by Anthony Boadle; Additional reporting by Brad Brooks in Sao Paulo; Editing by Rosalba O'Brien, Grant McCool and Michael Perry)