BANGOR, Maine — The Maine Supreme Judicial Court on Tuesday unanimously rejected a Hancock County couple’s efforts to have the child they had intended to adopt returned to them from Indiana, where he is living with his biological father.

The justices upheld an Oct. 8, 2013, decision in Hancock County Probate Court that denied the couple’s petition to terminate the biological father’s parental rights. Two weeks later, the boy, referred to in court documents as Tobia D., moved to Indiana to live with Ryan Masoner.

The Bangor Daily News is not identifying the couple.

Now nearly 4½ years old, the child lived with a Hancock County couple from the time he was born in September 2009 until last fall, when Hancock County Probate Judge James Patterson ordered that he transition to living with Masoner, 26, of Fort Wayne, Ind.

The legal battle over the boy began in December 2009 when Patterson gave temporary guardianship — the first step toward adoption — to the Hancock County couple with the mother’s consent. The boy’s mother, who admitted to having multiple sex partners including Masoner, did not tell the boy’s father she had given birth until the infant was 4 months old. Masoner began seeking his parental rights in January 2011, after he completed a prison sentence in Indiana, according to a previously published report.

Patterson ruled in the local couple’s favor. Masoner appealed that decision to the Maine Supreme Judicial Court. In March 2012, justices ordered that a DNA test be conducted to determine paternity and, if Masoner was the father, the termination of his parental rights be reversed.

Masoner proved to be the boy’s father and Patterson ordered that the child be moved to Indiana. The couple appealed again, arguing that Patterson erred when he concluded they had not met their burden of proving the father was unfit to parent the child; relied upon the guardian ad-litem’s report and testimony; refused to rule on their motion challenging the guardian ad-litem’s investigation; and failed to include a noncompliance provision in the child’s transition plan.

Justice Jon Levy, writing for the court, rejected those arguments.

“The evidence in the record did not compel the court to find that the father was unwilling or unable to take responsibility for the child within a timeframe reasonably calculated to meet the child’s needs,” he wrote in the 11-page opinion. “Competent evidence demonstrated that the father has taken steps to learn how to care for the child and address his needs.”

Bangor Daily News writer Bill Trotter contributed to this report.