Omar Ameen could not sleep at home. For years, he had been shuttling between safe houses, terrified that armed men would kidnap or kill him for the crimes of his cousin Ghassan, a member of Al Qaeda. Things often worked that way in Rawah, a small village in Iraq’s Anbar Province, where the Ameens had lived for generations. Tribal justice, long-running disputes: rivals denounced rivals as terrorists, and the state took care of the rest. “When you want to get revenge, you get revenge on the entire extended family,” Ameen later said. He and his brothers scattered to other parts of Iraq, leaving behind vast tracts of farmland, which were eventually taken by the people who had driven them out. On a chilly evening in early 2012, Ameen sneaked into Rawah and told his friends that he was leaving Iraq forever. He begged them to come with him. “You go first, dear,” one of them replied. “If everything goes O.K., we’ll follow.”

Ameen went to Turkey on a tourist visa, and applied for refugee status with the United Nations. He described to a U.N. representative a life of persecution from all sides. His father had been killed by Al Qaeda, he said, and one of his brothers had been kidnapped by a Shiite paramilitary group. Ameen was nearly forty, and he had wanted to leave Iraq since childhood. Only one per cent of refugees are selected for resettlement in new countries; he figured that victims of terrorism would be put at the top of the list.

Once approved, refugees have no say in where they end up: the U.N. decides whether to make a referral for possible resettlement, and when, and to which country. Ameen’s wife, Khansaa, and their three young children soon followed him to Turkey, where, after two years in limbo, Ameen logged in to the U.N.’s refugee portal and found that his family had been selected to resettle in the United States. On November 5, 2014, their plane landed in Salt Lake City. He found work at a Mormon charity and at a factory that produced dietary supplements. The children enrolled in school, and Omar and Khansaa began taking English classes.

That winter, another Iraqi couple from Rawah, who were living in California, visited the Ameens’ house. They spoke of the good weather and the opportunities in Sacramento; a few months later, the Ameens moved there.

Before the U.S. invasion, Ameen had worked as a truck driver, transporting cheap Iraqi oil across the desert to Jordan. It was a harrowing job; the sides of the highway were littered with the charred shells of trucks that had crashed and exploded, often with the drivers inside. Ameen learned to drive through fires as quickly as possible, terrified of burning to death. In Sacramento, he began working as an Uber driver and a delivery driver, sometimes pulling twenty-hour shifts to support his family. He also worked part time as a mechanic and became popular within the Iraqi diaspora. He and Khansaa applied for permanent-resident status and had a fourth child—an American citizen.

In July, 2018, Ameen sent a letter to his congressman, Ami Bera. “I called 2 times but I didn’t get any information about when I can get my green card,” he wrote. “I start having problems when I apply to the work because they asking about green cards.” Bera inquired with Citizenship and Immigration Services, which replied that it was “unable to render a decision on Omar Ameen application until certain issues are resolved.” Bera’s office forwarded the note to Ameen on August 13th.

Two days later, Ameen awoke to the sound of pounding on his apartment door. His son rushed into the bedroom and told him that there were dozens of armed men outside, and cars with flashing lights. When Ameen opened the door, he was placed in handcuffs. Television-news crews arrived at the scene. An anonymous caller had supplied them with Ameen’s address, along with a hint of the news: the Joint Terrorism Task Force had captured a high-level ISIS commander in the refugee stream.

A few miles west, in downtown Sacramento, a federal public defender named Ben Galloway heard that an Iraqi extradition case had just been made public. He skimmed through the court filings, which were heavily redacted, and learned that Ameen was accused of killing a police officer in Rawah, as part of an ISIS hit squad, a few months before he entered the United States. The government intended to send him back to Iraq, where he would stand trial for murder.

Galloway met Ameen at a federal building, where he was being held behind a mesh screen. Galloway, at six feet six, towered over Ameen by a foot. “It was a little difficult to see Omar, but quite easy to hear each other,” he recalled. With the help of an interpreter, Galloway summarized the criminal complaint. Ameen listened intently, elbows on the table, head hunched forward. As he began to understand the charge, he was overcome with relief. “I wasn’t even in Iraq at the time of the murder,” he said. “This will be easy.”

Soon after Donald Trump announced his candidacy for President, he began saying that terrorist groups had infiltrated the flow of refugees into the U.S. “We have no idea where they’re coming from,” he said, in an interview with ABC. “This could be one of the great Trojan horses ever, since the original.” Shortly before the election, he said, in a debate with Hillary Clinton, that Muslim refugees in the U.S. were “definitely, in many cases, ISIS-aligned.” His son Donald, Jr., a senior campaign adviser, posted on Twitter, “If I had a bowl of skittles and I told you just three would kill you. Would you take a handful? That’s our Syrian refugee problem.”

Security and intelligence officials found the rhetoric absurd: refugees are the most thoroughly vetted category of people entering the U.S. Candidates are screened by the C.I.A., the N.S.A., the F.B.I., the Department of Defense, and several other agencies before they arrive. They are interviewed by Homeland Security officers who have received training in identifying lies, along with intelligence briefings about the applicants’ country of origin. An office within the D.H.S. called the Fraud Detection and National Security Directorate carries out open-source and classified research on candidates from certain backgrounds. Biographical and biometric information is run through numerous databases and watch lists, including Interpol’s Foreign Terrorist Fighter Database, which is informed by the collective investigative capacity of fifty-two countries. The process often takes more than a year, and any red flag is ground for rejection, with no further explanation.

Ben Galloway, Ameen’s federal defender, in front of the jail where Ameen is being held. Photograph by Mark Mahaney for The New Yorker

The U.S. is particularly well equipped to find incriminating facts about applicants from Iraq. Between 2003 and 2011, the Department of Defense collected hundreds of millions of pages of information on Iraqis. “Some of what I have seen is really good information, and some of it cannot possibly be true,” a former senior U.S. official, who has spent decades working in the Middle East, told me. “Like, some poor kid is never going to go anywhere in his life because a friend chose to diss him to a D.O.D. employee, and now he’s blacklisted in the U.S. and European systems forever.” The U.S. military has also collected millions of Iraqi fingerprints and iris scans. As a former member of the National Security Council told me, “If you’re an intended terrorist, why would you go through that insane amount of vetting and waiting when you could literally just get a tourist visa?”