Update: This story has been updated with information on Sara Beltran Hernandez’s bond hearing March 2, which allowed her to leave detention and reunite with her family while she seeks medical care for a tumor in her brain.

Weeks after her story gained national attention with the help of Amnesty International, a 27-year-old Salvadoran immigrant with a brain tumor was granted bond and released from federal custody Thursday so she can reunite with her family while she seeks medical care.

But just last month, Sara Beltran Hernandez had a seizure and collapsed at a detention facility in Texas. She had been transferred there after waiting 16 months in federal custody for a judge to rule on her asylum request from a country devastated by gang violence and labeled the murder capital of the world.

Inside the woman’s brain, doctors found a large tumor in her pituitary gland, a benign mass that left her dizzy, forgetful and in pain, with appetite loss and bloody noses.

But instead of releasing her to her family or to the care of specialists, Immigration and Customs Enforcement agents, according to the woman’s attorneys, treated her like a dangerous criminal — shackling her, withholding information about her location and neglecting to provide her with adequate medical care.

ICE has denied these claims.

With the help of Amnesty International and a prominent Texas immigration attorney and law professor, her case garnered national attention amid the controversy over President Trump’s crackdown on illegal immigration.

Fatma Marouf, a local immigration lawyer on the case, told The Washington Post that Beltran Hernandez was “doing well and resting” Thursday evening.

“The moment we set foot outside the detention center, she had a huge smile and looked up to the sky,” Marouf wrote in an email to The Post. “You could tell she was soaking in the freedom.”

Upon release, she cried while thanking those who brought attention to her case, Marouf said.

Then, using FaceTime, she talked to her mom, whom she has not seen in the 16 months since she entered the United States.

Beltran Hernandez had not yet been reunited with her family late Thursday. Her attorneys are working to find the safest way to get her to New York.

Leading up to the hearing, her family was unsure how they would come up with the bond money, reported the Morning News.

“She needs a long medical treatment and maybe a surgery in the future,” Esmeralda Hernandez, Beltran Hernandez’s mother, told the Morning News.

In court documents filed last week in the U.S. District Court for the Northern District of Texas, attorneys for Beltran Hernandez offered a timeline of events they say paints an alarming picture of the way her case has been handled by ICE officials, including transferring the woman back to the detention center where she originally collapsed.

Beltran Hernandez crossed the border on Nov. 4, 2015, fleeing what she described as “severe domestic violence” from a boyfriend and “death threats” from a gang leader in El Salvador.

She was apprehended in Hidalgo, Tex., detained by Immigration and Customs Enforcement officers and passed a “credible fear” interview that qualified her to apply for asylum.

In the year and a half since, Beltran Hernandez has not left federal custody. An immigration judge denied her asylum petition and then twice refused to release her on bond during her subsequent appeal because, according to the judge, she was a flight risk.

In January, the same month Trump took office and signed a flurry of executive orders on immigration, she was transferred to a private detention center on contract with the government, where she continued to wait for a hearing on her asylum appeal.

More than 1,500 miles away in New York, her family waits as well.

Beltran Hernandez’s case is not unlike those of other asylum seekers across the U.S., where immigration court backlogs nationwide are leaving people like her in limbo.

Marouf, a law professor and director of the Immigrant Rights Clinic at Texas A&M University, took on the case after Beltran Hernandez was hospitalized, with her family unable to contact her for days.

After she collapsed, her family was notified but was not told the location of the hospital where Beltran Hernandez had been transported, her petition for habeas corpus (to get her out of custody) alleges. It took her East Coast-based attorney three days of calling “numerous hospitals” to find the woman at Huguley Hospital in Fort Worth.

“ICE did not want to disclose her location, so her name did not appear on the list of patients, making it impossible to contact her,” Beltran Hernandez’s attorneys allege.

Two guards from the correctional facility where she collapsed remained stationed in her room at all times, including when her medical information was being discussed with physicians, according to the court filing. Neither the guards nor her doctors spoke Spanish, the documents allege, leaving the woman unable to ask questions or communicate about her condition.

Nine days after she collapsed, Beltran Hernandez spoke to her mother on the phone and said she was having severe head pain and other symptoms. Worried, her mother asked a family friend who lives in Texas to visit the hospital. When the friend tried to enter Beltran Hernandez’s room, “she was immediately accosted by the two guards,” according to the court filing. The friend left “feeling frightened.”

That same evening, Beltran Hernandez’s attorneys on the East Coast solicited the help of Marouf, who took a translator to visit the woman at the hospital. The guards told Marouf to leave, she alleged, and said Beltran Hernandez was on a “no contact” list.

Marouf approached the woman anyway, but after a brief conversation was once again told to leave by the guards and later by a hospital administrator, even though, she says, she was breaking no rules by being there.

Approximately two weeks after Beltran Hernandez’s diagnosis, officials told the sick woman’s attorneys she would be transferred to “a hospital in Dallas better equipped to handle her medical condition.” Instead, she was moved back to the Prairieland Detention Center — the same place where she collapsed — in “handcuffs, with shackles around her waist and ankles,” according to her petition.

An ICE spokeswoman told the Associated Press that Beltran Hernandez was not restrained during her transfer and that she received phone calls from her attorneys and family while in the hospital.

Her lawyers also allege that ICE officials refused to allow Beltran Hernandez’s attorneys to attend a critical appointment with a neurosurgeon last week. In addition, they claim that in the detention facility she is “isolated in a medical room” and is checked on once a day by a nurse who administers pain medication but does not sufficiently monitor her condition.

“We are very concerned that the detention center can’t monitor her as she needs,” Marouf told the Dallas Morning News. “Every time I visit her, she is in pain. We are concerned that detention is exacerbating her condition.”

ICE has maintained in statements that the woman is receiving adequate medical attention.

Beltran Hernandez, who said she received death threats in El Salvador, left behind her two young children in hopes that she could bring them to the U.S. at a later date, reported the Morning News.

“After everything [Beltran Hernandez] has been through,” the woman’s sister, Raquel Beltran Hernandez, said in the court filing, “she does not want to die in prison.”

More from Morning Mix: