A top South African court has cleared the way for an eight-year-old girl, born to Cuban parents, to be granted South African citizenship.
This entitles her to access to health care, education and other welfare services which she had been denied.
As her parents have been out of Cuba for some time, the girl had been unable to claim Cuban citizenship and she had been effectively left "stateless".
This test case will affect other children in such legal limbo.
The case has been going through the South African courts for several years, and the Supreme Court of Appeal's decision came after the government challenged a ruling brought by a lower court.
The BBC's Karen Allen in Johannesburg says the home affairs ministry had argued that granting the girl a South African birth certificate would open the floodgates to new applications.
The court's judgement is a reaffirmation of existing laws in South Africa which give citizenship to stateless children.
The Supreme Court of Appeal gave the government 18 months to get its house in order and put in place a mechanism for processing similar claims.
Lawyers say the implementation of this ruling would bring South Africa into line with many other countries.
It could also help many of the thousands of stateless youngsters born in South Africa, who are now being put up for adoption and whose birth parents were foreign migrants or refugees, our reporter says.
A spokesman for South Africa's Department of Home affairs said it welcomed the chance to re-evaluate its position.
South Africa is home to many African migrants who have moved to the country for better economic fortunes in one of the continent's largest economies or to seek political refuge.
Latest Stories
-
We reaffirm our unwavering support for government’s efforts to ensure stable, affordable electricity – IPGG
3 minutes -
Baseball: Ghana’s Golden Palms retain African Youth Championship title
7 minutes -
ORAL is set up to settle political goals, revoke it – Ansah-Asare
7 minutes -
Hamas has accepted a draft agreement for a Gaza ceasefire and the release of hostages, officials say
9 minutes -
Joy Prime’s Changes Wedding Gown giveaway: Rose Abaya rocks gifted gown from Peace Bridals
13 minutes -
This economy has to deliver jobs for Ghanaians – Dr Theo Acheampong
19 minutes -
I went to Shatta Wale for advice during my campaign – A Plus
26 minutes -
Mahama embarks on peace mission to Bawku and Nalerigu
30 minutes -
Karela United closes in on Nurudeen Amadu as new head coach
51 minutes -
Kotoko’s Amoah ruled out for 2 months with ankle injury
1 hour -
Akufo-Addo’s government showed no interest in investigating election-related deaths – Peter Toobu
1 hour -
ORAL is corruption CCTV – Ablakwa
1 hour -
Rising bond yields point to fiscal challenges for sovereigns – Fitch
2 hours -
Otto Addo is not the right man for the Black Stars – Osei Palmer
2 hours -
ORAL operation: I receive threats daily – Okudzeto Ablakwa
2 hours