(CNN) An Arizona woman cannot use frozen embryos fertilized by her ex-husband to have children and has to donate them, according to a ruling by the state's Supreme Court.

Ruby Torres had her eggs fertilized before undergoing cancer treatment in 2014, court documents say. At the time, she and her then-boyfriend, John Joseph Terrell, signed an agreement at the fertility clinic that said if they split up the embryos could either be donated to another couple or used by one of them to have children -- but only with the "express, written consent of both parties."

The couple married days later and underwent in vitro fertilization, court documents state. The viable embryos were frozen and stored away. Torres' chemotherapy caused a "significant drop in her reproductive function," the documents say.

They divorced in 2017, kicking off a court battle. On one side is Torres, who wants to keep the embryos. On the other is Terrell, who doesn't want to father any children with his ex-wife and wants the embryos to be donated.

A family court initially ruled in Terrell's favor, saying his "right to not be compelled to be a parent outweighs (Torres') right to procreate and desire to have a biologically related child." An appeals court then overturned the family court's decision and ruled in Torres' favor.

Read More