DELRAY BEACH, Fla. -- A Florida woman's yearslong battle against her child's father over the boy's circumcision ended Friday with her agreeing to the procedure in exchange for her release from jail.

In a remarkable turnaround after a week behind bars for contempt and an initial hearing in which she was ordered to remain jailed, court reconvened and a sobbing Heather Hironimus signed paperwork giving approval for the surgery, recoiling in tears and clasping her shackled hands after it was done. The shift, though under duress, threatened the hero status given to Hironimus by a bubbling movement of anti-circumcision advocates who have followed the case's every turn.

She was expected to be released from jail later Friday.

Get Breaking News Delivered to Your Inbox

Attorneys for both Hironimus and the boy's father, Dennis Nebus, declined to comment, citing an ongoing gag order in the case.

Hironimus and Nebus had initially agreed to the circumcision in a parenting agreement filed in court, but the mother later changed her mind, giving way to seemingly endless litigation. Circuit and appellate judges sided with the father, but potential surgeons backed out after failing to get the mother's consent and becoming the target of protesters.

Hironimus went missing with the boy in February, ignoring warnings from Judge Jeffrey Gillen, whom she appeared before on Friday, to be in court and allow the circumcision to proceed. She remained missing until her arrest last week, staying in a domestic violence shelter. With her legal options dwindling, she filed a federal civil rights lawsuit on behalf of her son, looking for a solution outside of state court.

But her attorney abruptly withdrew that case Wednesday, two days after its first hearing, when a judge expressed open skepticism of its merits.

Upon arriving in court Friday, shackled and wearing a navy blue jail jumpsuit, Hironimus quietly invoked her Fifth Amendment rights when asked if she had signed the consent agreement. Gillen said she would be jailed indefinitely unless she did.

After reconvening, Gillen said: "You are both going to continue to be the parents to this young man. You're going to have to learn how to deal with that in an amicable, friendly, civil manner. You're going to have to always take into consideration what's in your child's best interest. To the extent that you may differ on things, you're going to have to talk them out. That's what parents do in a civilized society. You do not take the law into your own hands."