(CNN) -- Madonna's petition to adopt a second Malawian child was rejected by a local judge Friday, an official said.
Madonna is pictured leaving a court in Malawi late last month.
"The decision came down to residency requirement and the fact that the judge believes she was being well taken care of in the orphanage," said Zione Ntaba, a spokeswoman for the Malawi Justice Department.
"For the Malawians, the fact that the child is at an orphanage, is being taken care of and is going through the school education system, that does qualify as the best interests of a child," Ntaba added.
The 50-year-old pop star had filed a petition to adopt a girl, Chifundo James, 4, whose first name translates to mercy in Chichewa, the country's national language. She has three other children, including a son she adopted from the southern African nation in 2006. Watch more about the court's refusal »
The rejection follows weeks of criticism by human rights activists, who said Madonna was using her fame to circumvent a residency requirement for foreigners adopting in the country. Do you agree with the decision?
A coalition of local nonprofits from across the country accused Madonna on Thursday of taking advantage of a weakness in the country's child protection system. Days earlier, the charity Save the Children UK had urged the American singer to rethink the adoption and let the child be raised by her relatives.
Local media have reported that the child's teenage mother died days after she gave birth to her.
"This is a triumph for the children of Malawi," said Mavuto Bamusi, the national coordinator of Malawi Human Rights Consultative Committee.
"Inter-country adoption is not the best way of providing protection to children ... they should grow up in familiar cultural and religious surroundings," Bamusi said, adding that "supporting children from outside our country only helps five of the 1.5 million orphans we have."
Despite the controversies, a majority of Malawians were rooting for the adoption.
Marilyn Segula, a presenter at Capital FM, which broadcasts in at least five cities, including the capital, Lilongwe said Thursday that 99 percent of callers wanted the adoption to be approved.
"People are saying: 'Why are these [non-governmental organizations] pretending to care now? If anyone wanted to amend the law, they should have done it with other adoptions.' "
The recently divorced singer was married to British filmmaker Guy Ritchie. She has been involved with Malawi for several years and made a documentary, "I Am Because We Are," to highlight poverty, AIDS and other diseases devastating children in that country. She also co-founded a nonprofit group, Raising Malawi, which provides programs to help the needy.
All About Madonna (Entertainer)