A baby taken from his 18-year-old mother hours after he was born must remain in local authority foster care, a judge in Nottingham has ruled.
The child was removed from his mother by social workers on Wednesday - but then returned after a High Court judge ruled they had no right to take him.
The baby, known as G, will stay in care until further inquiries are made, District Judge Richard Inglis said.
The mother, who suffers from mental health problems, opposed the move.
Judge Inglis said: "In this case the court has decided that the welfare of G requires that he lives in local authority foster care on an interim basis while further inquiries are made and assessments carried out.
"His mother will have frequent periods of contact with him each week."
The baby was born to the woman, who has just left local authority care, in a Nottingham hospital on Wednesday.
He was removed without the mother's consent after hospital staff were shown a "birth plan" prepared by social workers from Nottingham City Council.
The plan said the mother, who had a troubled childhood, was to be separated from the child, and no contact allowed without supervision by social workers.
But Mr Justice Munby ruled they had acted unlawfully. The baby was reunited with his mother about 45 minutes after the judge's order was made.
In a statement issued after Friday's hearing, Nottingham City Council defended its actions and said it was pleased an interim care order had been made.
"The council and a range of other partner agencies had enough concern for the baby's welfare during the pregnancy to believe that action would be needed to protect the baby when it was born," the statement said.
"The law does not allow application for a court order before birth. The protection plan made in advance included the intention to apply for a care order immediately following the birth of this baby."
A spokesperson added the decision to seek an interim care order for an emergency protection order was taken at a meeting in December 2007, at which the mother and her legal representatives were present.
The case went to the magistrates' court and was later referred to the County Court on Thursday as part of an interim care order hearing.
The judge said: "When the further inquiries have been made, the court expects to be in a better position later this year to make a decision about who should care for G and what part his mother and other members of his family should play in his future care."
The pair cannot be named because of reporting restrictions. The interim care order was heard during a private hearing.