A novel way of putting a roof over homeless people's heads has been devised in Hungary: lock them in a prison cell by making homelessness a crime.
Under new rules, local authorities will have powers to impose community service and fines on rough sleepers. Repeat offenders face being jailed if convicted twice in six months.
A bill to criminalise living in public spaces was passed with a strong majority of 200 MPs at the parliament in Budapest.
Supporters of the move claimed there is there no cause for homelessness because there are sufficient shelters to cater for people with nowhere to live.
Critics said the law hits the most vulnerable in society. It is estimated around 30,000 people are homeless in Hungary. Protests outside the parliament ahead of the vote featured placards reading "homelessness is no crime."
Campaigner Tessa Udvarhelyi blasted the new law. She told the BBC: "Authorities should help vulnerable homeless people find dignified accommodation and work rather than punish them. It is a lie that there are enough hostel places for all, and what does exist is often not safe, clean, or dignified."
She said the law sets in stone negative attitudes encountered by the homeless. "[It] is codifying the fact that homeless people are stigmatised, harassed and criminalized."
Foreign media relations minister Ferenc Kumin said: "There are plenty of places for daytime and for nighttime shelter. We believe that [the homeless are] almost 100 percent covered."
Questions raised by the new law include how homeless people will pay fines, and whether jail can be a deterrent when it provides a homeless person with what they currently lack - warmer conditions and regular meals.
Previous attempts to legislate against homelessness were overturned by Hungary's Constitutional Court for violating human dignity.