A man who stabbed Brazilian President Jair Bolsonaro at a campaign rally last September has been acquitted, after a judge ruled he was mentally ill.
Adelio Bispo de Oliveira cannot be tried under Brazilian law because he was not fully aware of his actions at the time, the federal judge concluded.
But he said Mr de Oliveira was "high risk" and jailed him for an indefinite period so he can receive treatment.
Mr Bolsonaro said he would try to get the decision overturned.
"I will contact my lawyer. I will try to do whatever is possible," he told local media on Friday.
The president, who required surgery after the incident, suggested the attack was politically motivated and was masterminded by people other than Mr de Oliveira.
"They tried to kill me. I am certain who they were, but I can't say, I don't want to prejudge anyone," he said.
He added: "This is a crime against a presidential candidate who now has the mandate and we must go to the final consequences of that situation."
The acquittal comes several weeks after a judge ruled that Mr de Oliveira should be referred to a mental health institution.
What happened to the president?
Mr Bolsonaro, 64, suffered a deep and life-threatening wound to his intestines and lost 40 percent of his blood when he was stabbed in the stomach at a rally in Minas Gerais last September.
The far-right politician was placed in intensive care, fed intravenously and had to have a colostomy bag fitted. The bag - a small pouch used to collect waste from the body when the digestive system is no longer functioning as a result of an illness or injury - was removed in January.
Mr Bolsonaro, who took office as the country's new president on 1 January this year, is a divisive politician whom some analysts have compared to US President Donald Trump.
Mr de Oliveira, meanwhile, is a left-wing supporter who had been very vocal in his criticism of Mr Bolsonaro, posting messages on Facebook denouncing his policies.
Immediately after the attack in September, he was grabbed by supporters of Mr Bolsonaro, manhandled and beaten before being taken into police custody.