A female Malawi judge said she had to bar pop singer Madonna's second adoption from the country on Friday as giving the nod might have opened the doors to child trafficking.
But Madonna's counsel asserts her bona fides and says she would appeal the decision.
The 50-year-old star applied to adopt Chifundo James, whose name translates into English as Mercy, on Monday.
Had her application been successful, Chifundo would have been a sister to David, the first child she adopted from the African country, and her biological children Lourdes and Rocco.
Chifundo is in the same orphanage that previously housed David, now three years old.
Madonna's application was rejected because of a requirement that prospective parents be resident in the southern African state for 18 to 24 months.
"There is a gripping temptation to throw caution to the wind and grant an adoption in the hope that there will be a difference in the life of even just one child," Justice E.J. Chombo wrote in her ruling.
"But removing the very safeguard that is supposed to protect our children ... could actually facilitate trafficking of children by some unscrupulous individuals."
"Anyone could come to Malawi and quickly arrange for an adoption that might have grave consequences on the very children that the law seeks to protect," the judge wrote.
Court papers provided to CNN also revealed that the judge considered the petition different from that of David Banda, whom Madonna adopted from Malawi in 2006.
David "was to be returned to his biological father within a period of six months from the time that Mchinji Orphanage had admitted him," Chombo wrote.
"This is the same father that had desperately appealed for help after the death of his wife because of his incapacity to look after David and the unwillingness of wife's family to care for the child."
In the case of Chifundo, the orphanage taking care of her was able and willing, according to Chombo, who did not handle the first adoption. Court records show her 14-year-old mother died days after her birth.
Madonna's single mother status may have been a factor in the court's decision. A senior government official was quoted last week as saying: "Our official policy is that we do not encourage our children to be sent into broken homes."
The ruling followed weeks of criticism by human rights activists, who accused the mother of three of using her fame to circumvent a residency law for foreigners adopting in the country.
Save the Children UK had also urged Madonna to let the child be raised by her relatives in her home community.
The denial was applauded by a coalition of local nonprofits.
"Inter-country adoption is not the best way of providing protection to children ... supporting children from outside our country only helps five of the 1.5 million orphans we have," said Mavuto Bamusi, the national coordinator of Malawi Human Rights Consultative Committee.
Madonna's ex-husband Guy Ritchie said: "Madonna is a fantastic and loving mother who cares deeply about her own children, and children who may need additional help and support. I fully supported Madonna in her decision to apply for this adoption, and I am saddened that her application has been rejected. She is motivated only by being a caring parent who seeks to share some of the advantages and opportunities that her life has given her. This time it did not work out, but there will be other opportunities and I wish her well in them. She is a great mum."
Madonna's lawyer has filed a notice to appeal the ruling with the Supreme Court, according to Ken Manda, high court registrar.
Malawi is one of the world's poorest nations, with more than half of the population of 12 million living on less than one dollar a day. The singer has a personal fortune estimated at several hundred million dollars.
Madonna has set up a charity, Raising Malawi, which provides support for orphans and vulnerable children.
She has already built a multi-purpose community centre at Mphandula village, 30 miles from Lilongwe, which looks after more than 8,000 orphans from scores of villages in the area.