Aya Hijazi learned three years ago that being an American citizen can get you thrown in jail on trumped-up charges in Egypt — a country that claims to be a staunch American ally and accepts billions of dollars in U.S. aid.

Then she learned that being an American unjustly imprisoned abroad won’t necessarily get you any help or attention from the world’s most powerful government, even if it has plenty of leverage. The State Department might just prefer to keep quiet rather than rock the boat with that supposed ally.

Finally, Hijazi discovered that when a U.S. president does use his influence, he can have a quick and powerful effect — even when it is Donald Trump, who has loudly sworn off U.S. advocacy on human rights. Within days of Trump’s intervention on her behalf with Egyptian ruler Abdel Fatah al-Sissi last month, Hijazi was flown out of Egypt on a U.S. plane.

I met Hijazi and her husband, Mohamed Hassanein, this week to hear the story of how their attempt to do good in Cairo, and Hijazi’s American identity, did them harm — and then ultimately rescued them. Theirs is a tale not only about what can happen to activist Americans in an increasingly hostile world, but also about the difference it makes whether their government chooses to ignore them or go to bat for them.

Hijazi said she believes her U.S. citizenship is one reason she landed in an Egyptian prison after she and her husband founded a charity to help street children. Sissi’s regime regards civil society groups backed by U.S. money or activists as national security threats.

But there were other reasons, too: They were young and politically moderate. Young people drove the 2011 revolution against the military-backed dictatorship of Hosni Mubarak and so are seen as a strategic threat by Sissi’s regime of restoration. And “moderates are dangerous people because they can win hearts,” Hijazi, now 30, said.

The irony is that this couple, who survived prison by writing and smuggling letters to each other, never saw themselves as particularly political. Hijazi, who graduated from George Mason University, met Hassanein, the son of a Cairo shoemaker, six months after the revolution. They were intoxicated by the seeming potential for change in the country but disillusioned by the polarization of its politics.

So they decided, Hijazi said, to “start projects doing the work of politics — good governance — without getting into politics.” First, they noticed the city had a garbage crisis, “so we got into garbage.” Then they turned to an even bigger need: the street children who thronged the center of the city. They rented an apartment for their Belady Foundation and set out to give some of the children homes.

On May 1, 2014, the facility was attacked by a group of civilian thugs. Hijazi and Hassanein went to the local police station to file a complaint, only to find themselves detained along with other Belady staff. Seven criminal charges were brought against them, six of them carrying a life sentence.

No evidence was ever offered to back up the charges; instead, trial proceedings against the group were postponed repeatedly over two years. Hijazi was smeared on Egypt’s state-run media as a sex criminal and U.S. agent. Yet inside prison, her captors were puzzled: Why, they asked, did the U.S. government do nothing to help her? For more than two years, the State Department offered no public protest or even expression of concern about her case.

“I said either it was because I was not important enough, or because I was a dual citizen,” Hijazi recalled. “I felt abandoned. It was so sad to be forgotten and not cared about when America can do so much.”

When Trump was elected, Hijazi’s fellow prisoners taunted her: His support for Sissi and disinterest in human rights were well-known. So, Hijazi said, it was “a really pleasant surprise” when the new president intervened in her case as Sissi came to Washington in early April. Even better, she said, was that the result was not only her release, but also her acquittal along with Hassanein and all the other Belady staff. After being flown to Washington, Hijazi met Trump in the Oval Office.

“We actually didn’t talk too much about Egypt,” she said. “We talked about how he actually had made a difference. He showed that meetings behind closed doors can have an effect.”

Egypt, of course, is still festering, its prisons packed with as many as 60,000 political detainees, including as many as seven more Americans. Hijazi and Hassanein have drawn up a list of 50 “dire humanitarian cases,” people they believe may die if they are not freed. They hope their case will set a precedent. “If they responded to one,” Hijazi said of Sissi’s concession to Trump, “they can respond to more.”

Read more from Jackson Diehl’s archive, follow him on Twitter or subscribe to his updates on Facebook.