The Home Office has admitted that it unlawfully detained an Indian man for three months under immigration powers, separating him from his young daughter.
The father has been awarded £40,000 damages for "false imprisonment" and "disruption" to contact with the child, a Lithuanian national who is now four.
The Home Office will also pay the child £10,000 damages and the family's legal costs will be met.
Without legal intervention, the child could have been placed for adoption.
Stephanie Harrison, QC, for the man known only as AJS, told the High Court the case pointed to "systemic failures" on the part of the Home Office.
In June 2017, after AJS had served a prison sentence for wounding, the Home Office ordered him to be detained pending his deportation - despite a local authority recommending that he be reunited with his daughter so that he could care for her.
He was held under immigration powers at Wormwood Scrubs prison in London and then the Verne immigration removal centre, Dorset - 250 miles from where his daughter was living, in local authority care.
In July 2017, a family court judge endorsed the local authority's plan for AJS to look after his daughter, saying that, if he was not released within four months an application would be made for the girl to be placed for adoption.
The Home Office refused to move AJS so he could maintain contact with the girl, twice refused him bail and, when he was finally let out, placed him on an electronic tag with a curfew which meant it was impractical for the pair to be reunited.
The High Court heard that the Home Office now accepted it had acted unlawfully.
The process has begun for the man and his daughter to live together so that he can look after her.
Mr Justice Blair described the outcome as "reassuring and heart-warming".