(CNN) -- US President Donald Trump announced Wednesday that an American woman who had been detained in Iran since 2024 was allowed to leave the country.

Undated photo of Dena Karari provided by her lawyer. Courtesy of the family. Credit: Family of Dena Karari

Trump said the woman -- later identified by her lawyer as Dena Karari -- had been unjustly detained and is "now safely out of Iran and in good condition."

Trump wrote on Truth Social: "The United States of America appreciates this good faith gesture from Iran!"

Her departure comes as the US military continues to strike Iran following the collapse of the memorandum of understanding between the two countries.

Jared Genser, Karari's lawyer, described her ability to leave Iran amid the war -- and given her deteriorating health -- as a "small miracle." Genser told CNN that Karari, 53, had suffered a severe heart attack last week, and there were serious concerns about her health going forward.

Trump did not provide additional details about the circumstances of her release. CNN has reached out to the White House and the Office of the Special Presidential Envoy for Hostage Affairs.

Genser said Karari is on her way back to the United States, praising the Trump administration's efforts to help secure her return home.

Karari's case had not been publicly known before Wednesday. According to Genser, she traveled to Iran to visit her family, but when she went to the airport to leave, her passports (US and Iranian) were confiscated and she was banned from traveling.

Genser added that a month later, Iranian authorities stopped the car she was in with her family, where she was briefly detained and interrogated for hours.

Genser noted that she was ultimately interrogated dozens of times and placed under a "forced departure ban." He explained that she was targeted because of her management of a nonprofit called the "Mehr Children's Foundation," which provided assistance to needy children in Iran with funding from private donors and under a license from the Office of Foreign Assets Control (OFAC).