SAO PAULO/BRASILIA (Reuters) - Brazil’s far-right and poll-leading presidential candidate Jair Bolsonaro underwent a successful emergency surgery late on Wednesday to repair adhesions in his intestinal walls, according to doctors treating him.

FILE PHOTO: Presidential candidate Jair Bolsonaro leaves an agribusiness fair in Esteio, Rio Grande do Sul state, Brazil August 29, 2018. REUTERS/Diego Vara/File photo

Bolsonaro was stabbed last week by an assailant as he was carried aloft by supporters in a street rally. Doctors have said that he nearly died from his wounds, and he has been in hospital since the Sept. 6 attack.

The assassination attempt plunged the most unpredictable presidential race since Brazil’s return to democracy three decades ago into further confusion.

Bolsonaro widely leads polls for a first-round vote, but would lose to most rivals in an expected Oct. 28 runoff ballot, required if no candidate wins a majority.

The Einstein hospital in Sao Paulo where Bolsonaro is being treated said in a statement that the candidate’s abdomen became increasingly distended in recent hours and he was nauseated. A tomography indicated that an adhesion of the small intestinal walls had obstructed them. The surgery successfully repaired the obstruction.

Bolsonaro, 63, was in serious condition but had been moved Wednesday out of intensive care. Doctors have said that he would need additional surgery since he has a colostomy bag that needs to be removed and the intestine perforated by the stabbing repaired.

Bolsonaro became the front-runner in polling after the top electoral court banned jailed former president Luiz Inacio Lula da Silva from running because he is serving a 12-year sentence on a corruption conviction.

A seven-term congressman, Bolsonaro has positioned himself as the law-and-order and anti-corruption candidate. His support is fed by a surge in violent crime and Brazil’s worst-ever graft scandal, which has implicated much of the political class.

A retired army captain, Bolsonaro for years has angered many Brazilians with extreme statements on race, gender and sexual preference, but he is also seen by his many supporters as an outsider who can clean up a corrupt political system.

The Supreme Court this week rejected a charge of inciting hate for his making racist comments. The court is still weighing whether he should be tried for inciting rape for telling a congresswoman the floor of the house of deputies that he “would not rape her because she did not deserve it.”

He has openly praised Brazil’s military dictatorship and has said it should have killed far more dissidents. He chose as his running mate retired army general Antonio Mourao, who has warned the military could take over the government if courts did not punish corrupt politicians.