A family court in Chile has ruled in favor of a mother who was restricted access to her newborn daughter for 12 days for smoking marijuana. It ordered the hospital to discharge the baby.

Sindy Ortiz smoked pot to alleviate pain in one of her arms. She was allowed to see her daughter Luciana a couple of hours a day and wasn't allowed to breast-feed her.

On Tuesday, the baby left the hospital in the arms of her father next to an elated Ortiz.

Hospital officials had said they were following protocol when they alerted a court that tests found traces of substances that could put the baby at risk.

The court made the latest ruling after Ortiz presented results of a urine test that showed no traces of cannabis.