PHOENIX — In a first-of-its-kind case in Arizona, an Arizona Court of Appeals ruled Thursday that a woman locked in a custody battle over frozen embryos with her ex-husband will get to keep the embryos.

In its opinion, the court ruled that Ruby Torres' interests in using the embryos to become pregnant after her battle with cancer "outweighs" her ex-husband's "interest in avoiding procreation."

"We therefore vacate the trial court’s order and remand to the trial court to enter an order awarding Torres the embryos," the opinion reads.

The case involving Torres and her ex-husband John Joseph Terrell made national headlines last year and even sparked an Arizona law determining who would be awarded the frozen embryos in a future case like this.

PREVIOUSLY: Frozen embryo bill would dissolve prior agreements among couples

The embryos at the center of this case were created using Torres’ eggs and Terrell’s sperm after Torres was diagnosed with an aggressive form of breast cancer in 2014 and would have to undergo chemotherapy.

According to court documents, Torres was told by her oncologist that the chemotherapy would "impair her ability to become pregnant." The treatments would cause her to begin menopause and there was "no guarantee that [her] body would recover . . . and come out of menopause.”

Torres chose to undergo in vitro fertilization using her eggs and donor sperm. Terrell, at that time, was her boyfriend and, according to court documents, declined to be her sperm donor. 

However, once Torres began the process of persevering her eggs and found another sperm donor, an ex-boyfriend, Terrell agreed to be her donor.

According to the documents, he would later testify that he did it as a "favor." 

Court documents show the couple married four days after signing the IVF Agreement which specified that the embryos resulting from Torres’ egg and Terrell’s sperm would be their joint property 

The agreement also addressed the couple's preferences in the case of separation, divorce, death or incapacitation, which they selected to leave in the court's hand.

According to court documents, there were seven "viable embryos" as a result of the procedure which were persevered for future use. Torres underwent chemotherapy which dropped her hormone levels to "menopausal amounts."

The couple divorced after two years of marriage, according to court paperwork, and came to a disagreement over the fate of the embryos.

Court paperwork showed there had been "no attempt at implantation" during the couple's marriage.

During the evidentiary hearing, court documents showed "neither party contested that the IVF Agreement represented a valid, binding agreement regarding the disposition of the embryos."

According to court paperwork, Terrell said he never intended to have Torres use the embryos without his consent and signed the IVF Agreement because "he believed it was 'honorable' to do so under the circumstances."

Terrell said, according to the documents, that when he signed the agreement he "hoped to have children with Torres, 'if she survived.'" He, however, thought that her survival was "unlikely" at that time, court records show.

Terrell also testified that he would not have married Torres if she didn't have cancer and need his health insurance, according to court documents. He said he would not co-parent with Torres.

According to court paperwork, Terrell's desire to not have Torres use the embryos was rooted in his concern for his “financial liability in the future."

"Terrell also stated concerns about the possibility of Torres 'poisoning' a child against him and 'painting' him as a 'monster,' court documents showed.

According to court documents, both Torres and a fertility specialist testified that Torres would not be able to have children because of the chemotherapy.

Torres testified that if she were to conceive a child using the embryos it would be "Terrell’s choice whether he wished to be involved in the child’s life." She said she would not seek any child support and planned to implant the embryos "when, and if, she remarried," court documents said. She also testified it was "unlikely" she'd be considered for adoption because of her "cancer diagnosis and a genetic mutation 'BRCA1' that increased her cancer risk."

The trial court ruled in favor of Terrell saying his "right not to be compelled to be a parent outweighed Torres’ right to procreate." The court ruled the embryos be donated to a third party, per the IVF Agreement Torres and Terrell signed.

Torres appealed the ruling and the appeals court ruled in her favor Thursday, vacating the trial court's decision.

The court's opinion said it "especially" took into account that Torres "gave up the opportunity to use another donor and she is likely unable to become a parent (biological or otherwise) through other means."