The baby's mum wept in court as a judge finally ruled she could have her baby back six months after they were separated