A homeless man tried to set himself on fire to protest the city's treatment of the homeless population, but was thwarted by bystanders before he could go through with it, police said.

The man was taken by ambulance to a nearby hospital and placed in protective custody under a state rule, which allows authorities to commit people for up to 36 hours for psychological evaluations if they appear to be a danger to themselves or others.

The suicide attempt Friday happened during Project Homeless Connect, an event that provided food, health care and other social services to about 600 people.

The man shouted criticism of the city's policies on the homeless and poured gasoline over his head, said Sgt. Barbara Jones, a police spokeswoman. He was tackled by others before he could ignite himself.

The protest took place with a backdrop of public battles between city officials and social-advocacy groups over the rights of the homeless. City employees razed a downtown homeless encampment last month, and the Central Florida American Civil Liberties Union filed suit earlier this year after an ordinance that bans feeding the homeless in downtown parks without a special permit was put into effect.

Local ACLU Chairman George Crossley said the man had lived at the razed encampment and had run out of his diabetes medication at the time of the suicide attempt.