The appellants, Mr. and Mrs. B, appeal the district court’s decision denying their petition to adopt Mrs. B’s ten-year-old niece, R.P. They contend that the court failed to accord them the preference required by K.S.A. 1987 Supp. 38-1584(c)(3).
*504In a well-reasoned opinion, the district court found the appellants to be good prospective adoptive parents, but granted the petition for adoption of Mr. and Mrs. S, who had been R.P.’s foster parents for two and one-half years prior to trial.
No useful purpose would be served by recounting the tragic events of this case except to state that the natural father’s parental rights to R.P. have been severed and the natural mother is deceased. After reviewing the record, we conclude that the decision of the district court is supported by substantial competence evidence. The only remaining question is whether the district court erred as a matter of law by not granting the appellants’ petition for adoption after finding them suitable adoptive parents.
K.S.A. 1987 Supp. 38-1584(c)(3) provides as follows:
“Preferences in custody for adoption or long-term foster care. In making an order under subsection (c)(1) or (2), the court shall give preference, to the extent that the court finds it is in the best interests of the child, first to granting such custody to a relative of the child and second to granting such custody to a person with whom the child has close emotional ties.”
In their brief, the appellants discuss the legislative history of 38-1584(c)(3) at length. They argue that the legislature did not intend for close emotional ties with foster parents or other nonrelatives to affect the statutory preference for placement with relatives. In essence, they argue that the legislature has determined that placement of a child with a suitable relative is in the child’s best interests and that the trial court lacks discretion to determine otherwise.
The clear and unambiguous language of 38-1584(c)(3) belies the appellants’ argument. Preference to a relative shall be given “to the extent that the court finds it is in the best interests of the child.” In 38-1584(a), the legislature emphasized the court’s duty to act in the best interests of the child:
“Purpose of section. The purpose of this section is to provide stability in the life of a child who must be removed from the home of a parent, to acknowledge that time perception of a child differs from that of an adult and to make the ongoing physical, mental and emotional needs of the child the decisive consideration in proceedings under this section. The primary goal for all children whose parents’ parental rights have been terminated is placement in a permanent family setting.” (Emphasis added.)
The placement of a child for adoption requires careful consid*505eration of the facts of the particular case. In 38-1584(c)(3), the legislature has expressed the policy that preference for adoption should be given to a relative of the child. This policy, however, must be balanced with the policy “to make the ongoing physical, mental and emotional needs of the child the decisive consideration.”
We find that the district court applied 38-1584(c)(3) according to its clear intent and meaning. The court concluded that the best interests of R.P. would not be advanced by placing her with the appellants:
“That it would not be in the best interests of the child to destroy the trust and loving relationship that [R.P.] has been fortunate enough to have experienced over the last two and one half years with [Mr. and Mrs. S]. To do so may cause serious consequences and certainly would inflict great emotional pain upon [R.P.],
“The Court emphasizes that this decision does not disregard or reject clear statutory law and well established societal values and cultural expectations; but rather [t]his decision is based upon an overwhelming factual situation which dictates, in this court’s opinion, the application of an exception to the family preference to reach a decision clearly in the best interest of the child.”
The determination of the best interests of the child is within the sound discretion of the trial court. In re Johnson, 210 Kan. 828, 833-34, 504 P.2d 217 (1972). In this case, the district court correctly applied the law and did not abuse its discretion by concluding that R.P.’s best interests would be served by remaining with Mr. and Mrs. S.
Affirmed.