Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Margarita Del Pilar Fitzpatrick left her native Peru in 2001 to seek a better life in America.

Everything quickly fell into place: She studied English and earned a certificate as a medical translator. Eventually, she married and got a green card as she pursued a career in nursing. She saw her three daughters, born in Peru, become naturalized U.S. citizens.

She expected the same for herself one day. "I came here as a result of the injustice that I felt in my country," she recently told NBC News through tears, "which is an irony."

The Illinois resident is facing deportation after immigration officials discovered she voted illegally in two U.S. elections in 2006 — despite her objections that she was misled. Her protracted legal battle to stay in America is playing out amid sweeping reversals in immigration law and as President Donald Trump asserts a widely debunked claim that 3 million to 5 million "illegals" voted in the 2016 election.

"I would never put my family into this nightmare that I have been into — all these 10 years," Fitzpatrick said.

Her ordeal began when she visited a state Department of Motor Vehicles office in 2005 to get a driver's license. She said she presented her Peruvian passport and her green card, and declined on a form to register to vote.

Although she was obviously not a U.S. citizen, she added, a clerk asked her if she wanted to register.

"I was confused," she recalled. "I ask him, 'Am I supposed to?' And he said, 'Well, it is up to you.'"

She said she looked at a voter registration form and marked "yes" next to a U.S. citizen box, unable to find one referencing what she was: a legal permanent resident.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Margarita Del Pilar Fitzpatrick's voter registration.

The government later sent her a voter registration card. She subsequently voted in two elections, thinking it was all above board.

After moving ahead with her citizenship application in 2007, Fitzpatrick said she freely told the immigration officer that she voted — not knowing she had done anything wrong. She had.

She canceled her voter registration, but it was too late. Two months later, she got a letter in the mail saying immigration officials had ramped up their efforts to deport her.

Fitzpatrick later found help from Chicago immigration attorney Richard Hanus, who says people in her situation are not uncommon.

"They've fallen into a trap where they're either registering or getting voter cards without knowing that they're not eligible," Hanus said.

Related: Study Finds No Evidence of Widespread Voter Fraud

Those people might be unwittingly caught in a federal law meant to make it easier for citizens to register to vote.

The National Voter Registration Act of 1993 states that driver's license clerks cannot "make any statement to an applicant or take any action the purpose or effect of which is to discourage the applicant from registering to vote."

According to Hanus, "the system, in its effort to be as inclusive as possible, is asking and soliciting folks that aren't U.S. citizens" — the same argument he made in front of the 7th Circuit Court of Appeals in Chicago.

A federal judge reviewing Fitzpatrick's case appeared to make the same point, asking prosecutors why she was even asked about registering to vote in the first place when the clerk should have seen she wasn't an American citizen.

Margarita Del Pilar Fitzpatrick.

Even so, the courts ruled that Fitzpatrick broke the law and must be deported.

Just because she might not have known she was committing a crime, it doesn't change the fact that she did, said Thomas Fitton, president of Judicial Watch, a conservative public interest group.

"Like everyone else caught making a mistake that is actually a crime, they have [the] ability to tell it to the judge," Fitton said. "And if someone doesn't buy it, that's the way the system works."

A Department of Homeland Security spokesperson said Fitzpatrick "rendered herself deportable when she gave a false claim to U.S. citizenship in 2005 by signing the voter registration form on which she declared herself to be a U.S. citizen."

Related: Top U.S. Election Official: There Is No Voting Fraud 'Epidemic'

Her case moved through immigration and appeals courts. She was taken into Immigration and Customs Enforcement custody in 2015 for a day before being released on supervision as the appeals process continued.

It's not yet over for her either. Hanus said she has another shot at an appeal, although her daughters recognize their mother may be on borrowed time in the United States.

"We hope that the nation can see my mom as who she is," said daughter Amy. "And even though this is a snippet of everything ... my mom deserves more than what she's going through. And I hope that we have faith that whatever happens, justice will come."