The front-runner in Brazil's presidential election, Jair Bolsonaro, has been stabbed at a campaign rally.

The far-right politician was attacked in a crowd in the south-east state of Minas Gerais. A suspect was arrested.

Mr Bolsonaro had surgery for injuries to his intestines and is expected to recover, hospital officials said.

The controversial politician, who has outraged many in Brazil with racist and homophobic comments, has performed strongly in recent opinion polls.

The polls suggest he will get the most votes in the first round of the October presidential elections if former President Luis Inácio Lula da Silva remains blocked from standing, but he is unlikely to win a run-off.

Left-wing Lula had been the long-standing favourite but he is currently in prison, appealing against a ban on his candidacy that was imposed after his conviction for corruption.

Some of Mr Bolsonaro's past comments have caused uproar, including equating homosexuality with paedophilia, and saying a congresswoman was too ugly to be raped.

How did the attack unfold?
Footage of the incident in the city of Juiz de Fora shows Mr Bolsonaro making a thumbs-up gesture and being held aloft by supporters when he is stabbed with what appears to be a knife.

He then doubles over with pain and his supporters quickly lower him to the ground and bundle him into a car.

After the attack, his son Flavio tweeted: "Unfortunately it was more serious than we had expected. He lost a lot of blood, arrived at the hospital with a [blood] pressure of 10/3, almost dead. His condition now seems stabilised. Pray, please!"

Hospital officials later said Mr Bolsonaro had suffered a "deep" and life-threatening stab wound in his intestines and was in a "serious but stable" condition.

He was recuperating well in intensive care after two hours of surgery, they added, but would spend at least a week to 10 days in hospital.

He has since been filmed in his hospital bed, making a hoarse statement. He described how what he thought was "just a blow" turned into an unbearable pain. He had "never hurt anyone", he said.

Police said a suspect had been arrested, naming him as Adelio Obispo de Oliveira, 40. Officials quoted by Reuters news agency said he appeared to be mentally disturbed.

He was manhandled and beaten by angry supporters of Mr Bolsonaro before being taken into custody.

What has been the reaction?
Mr Bolsonaro's electoral rivals have all condemned the stabbing. Fernando Haddad, who is expected to replace Lula on the Workers' Party ticket, said the attack was "absurd and regrettable".

Speaking in the capital Brasilia, President Michel Temer said such an attack was "intolerable" in a democratic state and that he hoped Mr Bolsonaro recovered soon.

The president's predecessor, Dilma Rousseff, warned that the attack must not go unpunished.

Brazilian stocks rose after the attack on Mr Bolsonaro, as it was seen as increasing his chances. His free-market economics make him popular with investors.

Why is Mr Bolsonaro so polarising?
The 63-year-old, who is representing the Social Liberal Party (PSL), is followed by millions of Brazilians on social media, and many refer to him as the "Brazilian Trump".

He also supports loosening gun control laws, and is backed by millions of evangelical Christians for his uncompromising anti-abortion stance.

A former army captain, Mr Bolsonaro entered politics in the 1980s to defend the rights of military personnel.

Few imagined at that time that he could become a serious contender. But the collapse of the Workers' Party government and the impeachment of President Rousseff two years ago revealed the extent of political divisions.

Mr Bolsonaro's outspoken rhetoric and his defence of law and order appealed to many who blamed the left for corruption and the economic crisis.

In 2011, he told Playboy magazine that he would be "incapable of loving a gay son" and that he would rather see such a son of his "die in an accident".

In 2015, he was fined for saying in a newspaper interview that Congresswoman Maria do Rosario was "not worth raping; she is very ugly".

He is currently being investigated for alleged racism over derogatory remarks he made about Afro-Brazilians.

Who will be Brazil's next president?
President Temer, an unpopular leader, is not standing for re-election, and millions of voters remain undecided.

Mr Bolsonaro is expected to have a strong first round but lose a run-off to leftist Ciro Gomes, environmentalist Marina Silva or ex-Governor of Sao Paulo Geraldo Alckmin, according to leading research company Ibope.

A race against Lula's likely replacement, Fernando Haddad, could be much narrower. Ibope said its most recent survey showed Mr Bolsonaro losing to him by just one percentage point.

Mr Haddad was charged with corruption earlier this week and, like Lula, denies any wrongdoing.

On Thursday, the Supreme Court rejected Lula's latest appeal to run. The Workers' Party has until the end of Tuesday to register Mr Haddad as its presidential candidate.