Alex Haigh, who had come to London seeking work, sentenced to 12 weeks in prison for occupying flat without permission

A 21-year-old man arrested at a flat in Pimlico, central London, has become the first person to be jailed under the government's anti-squatting legislation.

Alex Haigh, originally from Plymouth, has been sentenced to 12 weeks in prison after pleading guilty to occupying a housing association flat without permission.

The Crown Prosecution Service confirmed that Haigh was the first person to be given a custodial sentence under section 144 of the Legal Aid, Sentencing and Punishment of Offenders Act, which came into force on the first day of September.

West London magistrates heard that police officers had gone to the flat in Cumberland Street on 2 September in search of another man. They arrested three people, one of whom was Haigh, on suspicion of squatting and all three have been convicted; the other two are awaiting sentence.

The law criminalises squatting in residential premises. Housing charities have warned that it may trigger a surge in homelessness as squatters are forced on to the streets in order to avoid a criminal record.

The squatters' rights group Squash (Squatters' Action for Secure Homes), which campaigned against criminalisation, condemned the sentencing as "deeply disproportionate and unjust". It said the building the men were occupying had been empty for more than a year.

Haigh's father, Hugh, told the Evening Standard newspaper that his son, an apprentice bricklayer, had come to London in July seeking work. "They have made an example of him. To put him in that prison environment, I don't understand it. If he broke the law, he should be dealt with, but it is like putting someone who has not paid their taxes into Dartmoor prison."

Rueben Taylor, from Squash, said: "This marks a dark day for our country, as a young vulnerable person is being sent to prison simply for trying to keep a roof over his head.

"The real crime is the 930,000 properties sitting empty across the UK, not the people who are bringing these back into use. This crazy law is aggressively punishing the victims of our housing crisis, at massive cost to the taxpayer."

Under section 144, squatting in England and Wales is punishable by up to six months' jail and fines of up to £5,000. The change in the law does not affect commercial premises.

In a circular sent to judges, courts and the police, the Ministry of Justice confirmed that what were previously known as "squatters' rights" – preventing forcible entry to an occupied building – would become redundant in relation to residential premises.

Squash claims the cost of criminalising squatting will be as high as £790m over the next five years.