Former X Factor contestant Gamu Nhengu, her two brothers and her mother have won their fight to stay in the UK.
The teenager and her family, originally from Zimbabwe, had been refused leave to remain in the UK in February by the Home Office.
Earlier this year, the family successfully appealed the decision, but the Home Office then tried to overturn the decision and have the family deported.
The Home Office confirmed a judge at the Immigration Court in Glasgow refused the Home Office appeal - meaning that the young singer and her family have been granted leave to remain in the country.
The family's lawyer, Frances Farrell, said the family were "delighted".
She said: "This has come after such a long ordeal.
"The Home Office has a last resort appeal right to the Court of Session, but I hope they respect the judgment made today.
"My client has been granted leave to remain in the UK so now she and her family are able to get on with their lives and put this behind them."
The teenager, who lives in Tillicoultry, Clackmannanshire, shot to fame on last year's X Factor when she was controversially booted off the show during the judges' houses round.
Gamu was dropped by judge Cheryl Cole, who took Katie Waissel, Cher Lloyd and Rebecca Ferguson through to the live finals.
The singer's mother had her visa renewal turned down in August 2010, sparking a long battle against deportation to Zimbabwe.
But a UK Borders Agency spokesman said they were "disappointed" with the ruling.
He said: "We are disappointed with the court's decision in this case and will be looking closely at the judgment.
"The UK Border Agency considers every case carefully and where we do not believe someone has the right to stay in the country, and they do not require our protection, we expect them to return home."