A local council acted illegally in detaining a 21-year-old autistic man in a care unit rather than allowing him to live with his father, a high court judge has ruled.

In the judgment, the London borough of Hillingdon was criticised for unlawfully detaining Steven Neary and breaching his human rights after refusing to allow him to return home following a brief period of respite care, despite his desperate father's pleas that home was the best place for him.

Mr Justice Peter Jackson said Mark Neary, 52, who spent a year battling the council, could be "proud of the way in which he has stood up for his son's interests".

Hillingdon acted as if it had the right to make decisions about his son, and by a "combination of turning a deaf ear and force majeure, it tried to wear down Mr Neary's resistance", the judge said.

"It is very troubling to reflect that this approach might actually have succeeded, with a lesser parent than Mr Neary giving up in the face of official determination," he added. Had the council succeeded, Steven Neary "would have faced a life in public care that he did not want and does not need".

After the ruling, Mark Neary, a counsellor from Uxbridge, said: "I'm relieved, tearful, satisfied. I feel vindicated. I knew Steven should be at home because I know Steven. But there was always more of them than there was of me."

Outside court Linda Saunders, Hillingdon's director of social care, apologised, telling him: "I am sorry that we have let you down at times, and clearly we have."

This is the first case in which journalists have been allowed access to the normally private hearings of the court of protection in London, after representations by media organisations, including the Guardian.

It revealed how local authorities authorise deprivation of liberty orders (DOL) under the Mental Capacity Act 2005. Hillingdon failed to comply with statutory safeguards, said the judge, resulting in "a code designed to protect the liberty of vulnerable people being used instead as an instrument of confinement".

Steven Neary, who also has a severe learning disability, lived with his father in Uxbridge. He requires adult supervision at all times. Until December 2009 this was provided by his father and a team of council-funded day carers.

At Christmas 2009 his father, who was "unwell and exhausted", agreed that his son would go to a positive behaviour unit for "a couple of weeks" viewing the move as temporary. Neary thought his son would be home by late January 2010.

The council said care staff had concerns about Steven Neary's challenging behaviour and weight, and argued that the move should be for a longer period. His father had not consented and "authorisations relied on were flawed", said the judge.

Steven Neary stayed at the unit for about a year, returning to his father's home in December 2010 after a court order.

Though he was "necessarily critical" of Hillingdon, said the judge, everybody concerned "genuinely wanted to do the right thing", and problems arose "from misjudgment, not from lack of commitment".

But the case "was characterised either by an absence of decision-making or by a disorganised situation where nobody was truly in charge, and it was consequently possible for nobody to take responsibility", said the judge.

Even when one very senior social work manager had "serious concerns" about what was happening, this had no effect on the "corporate position".

Nowhere in Hillingdon's records of his year in care was there mention of the "supposition he should be at home, other things being equal, or the disadvantages to him of living away from his family".

"No acknowledgement ever appears of the unique bond between Steven and his father" or the "priceless importance" of being cared for by a parent rather than strangers, and no attempt was made to carry out a genuinely balanced best-interest assessment, said the judge.

Steven Neary was represented by the official solicitor, and by his father, who could not afford legal representation but was not eligible for legal aid.

The 21-year-old suffered no significant long-term harm, added the judge, although the events were distressing for him and his father. "However, things might easily have turned out differently," he added. Hillingdon had plans to send him on a long-term placement outside London, "which could have caused irretrievable damage to his family ties, and particularly his very close relationship with his father".

The judge criticised Hillingdon for circulating a three-page media briefing during the hearing, designed to "counteract adverse publicity", which he described as "a sorry document, full of contentious and inaccurate information, and creating a particularly unfair and negative picture of Steven and his behaviour".

It has now been agreed that Steven Neary will remain at home with high levels of support.

After the hearing, Saunders said: "Cases such as Steven's are hugely complex and we always have to carefully balance what we think is right for an individual with the wider issues such as the safety of the public. We recognise that we need to improve our processes."