Faiz Khalil was a colonel in the Iraqi Army, whose work with the United States military may have provoked the killing of his 8-year-old daughter. Mohamed Sharif was a student in Mogadishu, Somalia, an urban war zone terrorized by rival militias.

Both arrived in the United States as refugees, through a yearslong process that involved hours of interviews and more than a dozen background checks from at least five American agencies. In late January, President Trump signed an executive order to suspend that program, after saying for months that the vetting process needed re-examination. “We have no idea who these people are,” he said of Syrian refugees in 2015. “This could be one of the great Trojan horses.”

The State Department notes that refugees are the most rigorously examined travelers to the United States. As the program’s future hangs in limbo — last weekend refugees began coming in again, after a legal challenge to the executive order — we trace the many steps already in place, through the eyes of Mr. Khalil and Mr. Sharif.

Mr. Khalil, 54, now resides in Twin Falls, Idaho, as an American citizen, while Mr. Sharif, 26, lives in Aurora, Colo., as a legal permanent resident.

Registering With the United Nations as Refugees

The United Nations gathers the names of people who have fled persecution.

Faiz Khalil

Mr. Khalil was in a daze when he arrived in Amman, Jordan, from Baghdad in July of 2006. He had been anxious, depressed and unable to think clearly ever since his daughter Maha left for school one day and did not return.

“I was totally lost,” he said.

Mr. Khalil had tried to keep his work with the United States military a secret, even from his family, because he knew that it would make them a target for terrorists. But the day after Maha disappeared in 2004, he received a phone call from someone claiming to be a member of Al Qaeda. The man said that Mr. Khalil had been found out, and would have to pay with Maha’s life.

After the family learned that Maha was, indeed, dead, they tried to continue living in Baghdad, where they had the support of their extended family. But they felt they were still being watched by Maha’s killers, and that their other children could be in danger. In 2006, Mr. Khalil left Iraq with his wife, Nahida Mohammad, their 8-year-old son, Mamoon Jumah, and 4-year-old daughter, Maryam Jumah.

They moved into a cramped third-floor walk-up apartment, which they paid for with the money saved from selling their home in Iraq. But as unauthorized immigrants, they could not work and had to send the children to private school, because they were ineligible for public benefits. Knowing that their savings would not last, Mr. Khalil registered them as refugees with the United Nations. He hoped they would be relocated to Britain, where his brother lived, or Australia, where he had a friend.

_____

Mohamed Sharif

Mr. Sharif fled Somalia at age 16, arriving at Kakuma, a refugee camp in northwest Kenya, in 2007. His country had gone through more than a dozen attempts to form a government in his lifetime. It was dangerous for Mr. Sharif to return. More recently, Islamists had taken over — the most militant of them were known to drive around with black flags and shoot people for watching Hollywood movies.

Kakuma was a desert camp split by a river, where the temperature often topped 100 degrees. Mr. Sharif came alone, moved into a sheet-metal hut and registered as a refugee.

In the camp, he met Bisharo, a single mother with two children, Adnan and Hodan. She had also fled Somalia. “We understood each other,” he said. He picked up work as an electrician. They married, but there was no big wedding. “We didn’t have enough money to make a party.”

Interviewing With the United Nations

An officer hired by the United Nations sits with the applicant, asking hundreds of questions about his or her life. Afterward, two officials review the case to determine if the person faces serious persecution back home. If concerns of credibility arise, the person undergoes another interview or the case is closed.

Faiz Khalil

Mr. Khalil and his family arrived, as instructed, with their birth certificates, proof of Iraqi citizenship and marriage certificate, at a massive building with blacked-out windows in the northwest corner of Amman. Armed guards were posted outside. They waited in line among hundreds of Iraqis — soldiers, farmers, shopkeepers — all hoping to gain refugee status.

Later, as they were photographed, fingerprinted and interviewed over the course of seven hours, they overheard as other Iraqis were denied refugee status. There were tears, yelling, frustration — everyone was pessimistic, no one thought they had a chance.

When a United Nations official asked Mr. Khalil through an Arabic interpreter about his daughter Maha, he broke down in tears.

“I felt really emotional because it was fresh,” he said. “I could not control myself.”

As they awaited news from the United Nations, the family began to unravel. No one could sleep through the night, still distraught over Maha’s death. Mr. Khalil and Ms. Mohammad walked their children to and from school each day, fearing that something could happen to them.

A few months later, the call came. Mr. Khalil was to return alone to the same building, and to bring more documents, including Maha’s death certificate.

_____

Mohamed Sharif

It was a big day. By 2012, Mr. Sharif had waited five years at Kakuma before an official from the United Nations arrived for an interview. Mr. Sharif wore a football T-shirt — he had no dress clothes, and the camp, which was sweltering, was not a place for a suit or tie anyway. The official asked him to tell his story. Bisharo and their children sat with him.

Why did he leave Somalia? Mr. Sharif described in Somali the way he had fled his home, fearing death, without a birth certificate or school records.

“I have no hope back there,” he later recalled having said. “I don’t have a home to go back to. No one is there.”

The interview lasted 90 minutes. Then a break, then more talking — another hour’s worth.

Months later, Bisharo gave birth to a baby girl, Nimo. Two weeks afterward, Bisharo died. At 22, he was suddenly the single father of three children.

Interviewing With State Department Contractors

United States contractors conduct extensive in-person interviews to prepare for a visit from Homeland Security. Background checks begin: At least five agencies search for applicants in their databases, checking for criminal violations, alternative names and connections to bad individuals and dangerous groups.

Faiz Khalil

This interview focused on Mr. Khalil’s time in the Iraqi Army. Why did he enlist, he was asked. Because of the promise of a stable life. Why did he become an officer? Because of the benefits: a new car and a piece of land.

He described teaching American soldiers about the Iraqi chain of command, which was different from the Americans’, and telling the Americans to request receipts with serial numbers for deliveries of items like batteries or tires — otherwise, he said, some could end up for sale on the Iraqi black market.

Mr. Khalil answered his interrogators “like a robot,” he later recalled.

“I said, ‘I don’t care if they will accept it or not,’” he said. “I lost my daughter, I lost my house — everything.”

During this time, Mr. Khalil and his family watched nervously as their bank accounts dwindled. They had to pay $3 a day per person to the Jordanian government to live there without authorization. It was now winter, and they had never lived anywhere it snowed. They could not afford enough diesel fuel to heat their apartment through the season, so Mr. Khalil and Ms. Mohammad took turns waking up in the middle of the night to turn on the heater for an hour at a time.

_____

Mohamed Sharif

This round of interviews, in 2013, took three days, with each talk lasting an hour, an hour and a half. In the first interview, Mr. Sharif cried as he told his story, and so did his interviewer. In the second and third, he had to tell his story again.

Before each interview he had to raise his hand and swear to tell the truth.

They asked about his birthplace, his parents, their marriage, his schooling, his journey to the camp, his religion. What political groups was he with? Had any extremists tried to recruit him? When he got to the United States, would he do anything against the law?

“The answer is no,” he said later. “Because the reason we are here is to get a better life. To get our freedom.”

The interviewers requested documents. “I didn’t have any,” he said. This a common problem in camps where people come from some of the poorest nations. “Most of our people,” he said, “they didn’t go to school, they weren’t born in the hospital.”

The same year, Mr. Sharif met Ubah Isse Mohamed, a neighbor in the camp, and they married. “She was loving,” he said. “The right person for my kids.”

Interviewing With Homeland Security

American officers visit the camp to verify stories and take fingerprints. Some nations skip this step and rely on the United Nations interviews when screening the people they accept.

Faiz Khalil

Winter receded and the family was called back to the guarded complex in the spring for another appointment, this one lasting 12 hours.

Ms. Mohammad and the children were interviewed together; he was questioned alone.

As he remembers it, American immigration officials asked hundreds of questions — many of them repeats from previous interviews — but the American agencies wanted even more detail.

In between sets of questions, Mr. Khalil was sent to the waiting room, sometimes for an hour or more. He and his family were fingerprinted again, and their retinas were scanned.

_____

Mohamed Sharif

In the summer of 2014, American officials finally came to Kakuma, and 70 or 80 families waited to be interviewed.

An official again asked Mr. Sharif to recount his story.

Then came a barrage of yes-or-no questions. Had he ever been recruited by terrorist agencies? By radical groups? No, he said. No.

Then he waited.

Getting Approval and a Health Screening

All refugees go through a medical exam to identify needs and ensure that people with a contagious disease, like tuberculosis, do not enter the United States until they have been cleared.

Faiz Khalil

By the summer of 2007, the Khalil children had begun to speak Arabic with a Jordanian accent. The family members were sent to a medical clinic for three days of health evaluations. On the first day, they were X-rayed and immunized. On the second, they received basic physicals and had their blood drawn. Day 3 consisted of mental evaluations. Mr. Khalil and his children received diagnoses of post-traumatic stress disorder.

It was not until almost Christmas that Mr. Khalil was called back to the guarded office and handed a yellow envelope. “You have the initial approval on your case,” he recalled an official telling him. The family still needed security clearances, though, so they would have to keep waiting.

In early 2008, Mr. Khalil answered a call on his cellphone. “Congratulations,” he recalled an American government official saying on the other end. “You’re moving to Twin Falls, Idaho.”

Mr. Khalil had never heard of the city or the state. “I said, ‘This is in the U.S.?’”

He did a quick search online: “I saw it was small town. It really scared me more, because I said, ‘I am going to nowhere.’”

They were scheduled to leave Sept. 22, 2008. As the day drew nearer, Mr. Khalil felt conflicted. One day he was excited, the next scared. Maybe they would fail, he thought. He had heard that life in America was difficult.

____

Mohamed Sharif

One day in 2014, his phone rang. It was a camp official, saying he had a letter. At the office, he ripped it open. The United States wanted to welcome him. His children and Ms. Mohamed, who were further behind in the process, would have to stay in Kenya.

Then came a checkup at Kakuma that took three days. There was an eye test, a urine test, a blood test, five or six immunizations, an X-ray.

In early December, he left the camp for a local airport, really just an airstrip holding a small aircraft. He flew to Nairobi, where he spent a week in another camp. And on Dec. 10, at midnight, he left Kenya for good.

Arriving in the United States

Nine nonprofit organizations help refugees settle in the United States. They decide where these new immigrants will live, often opting for more affordable midsize cities.

Faiz Khalil

On the morning they were set to leave for the United States, Mr. Khalil woke up in tears, and he struggled to compose himself all the way to the airport. At one point, overcome by fear, he asked their taxi driver to turn around. “Don’t listen to him!” Ms. Mohammad shouted.

At the airport, something changed. “I had to be strong to support the family,” Mr. Khalil explained later.

They traveled for 36 hours on four different planes: first to Frankfurt, then Chicago, Salt Lake City and, finally, Twin Falls.

It was close to midnight when they arrived. The children were exhausted.

“There is no shopping, there is no life,” he said. “It was just dark, nobody in the streets, so I was kind of like, ‘Where we are?’”

____

Mohamed Sharif

He touched down at the Denver airport on Dec. 12, in the early evening. A man from Lutheran Family Services brought him to a new apartment. The following night it snowed, and Mr. Sharif walked outside to take in his first snowflakes.

“I looked up at the skies, and got it in my eyes,” he recalled. “It was really just something amazing for me.”

“Some refugees who were in my neighborhood have been in the camp from 1991 until now,” he said. “For me, I can say this: I was the luckiest guy ever. Ever.”

Living in the United States

Refugees can receive federal cash assistance for up to eight months, with stipends varying from state to state. They can tap into federally funded language instruction courses, employment services and social adjustment programs for up to five years. They are required to apply for permanent residence — their green card — after their first year.

Faiz Khalil

In the morning light, Twin Falls did not appear as foreboding. Mr. Khalil and his family had never imagined living in the United States, but they have warmed to their new home.

The children learned English quickly, while Mr. Khalil and Ms. Mohammad practiced by watching “Grey’s Anatomy” and Ms. Mohammad’s favorite movie, “Titanic.” Both now work as interpreters for the local refugee resettlement center, and Mr. Khalil continues to advise United States military troops on how to work in Iraq.

Mr. Khalil and Ms. Mohammad are both registered independents, but they typically vote for Democrats, including Hillary Clinton. Mr. Trump’s executive order on refugees was unfair, Mr. Khalil said, because of how other Iraqis would suffer after working to help the American military. “They are supposed to support us,” he said.

Maryam is now a 14-year-old, but acts as if she were much older, according to her father. Mr. Khalil said that Mamoon, now 19, is “very American,” n in that he sometimes speaks to his parents with a “sharpness” to which they are unaccustomed.

When Mr. Khalil thinks of Maha, he likes to look at old family photos from Iraq. His children rarely bring her up in front of him, for fear of triggering another bout of depression. But when they do not know he is listening, he occasionally overhears them talking about their sister.

“I am glad for them,” Mr. Khalil said. “They have a good life, better than I had.”

____

Mohamed Sharif

He works as a truck driver, hauling goods across America’s most spectacular landscapes. He is on the road constantly, working long hours to save for the arrival of Ms. Mohamed; Nimo, now 3; and his stepchildren, Adnan, 12, and Hodan, 13. They live in Nairobi, but cannot work or go to school because they do not have Kenyan documents. Without them, he said, “I am alone.”

Mr. Sharif’s stepdaughter Hodan, 13, and 3-year-old daughter, Nimo, who currently live in Kenya, in a photo he provided.

On Jan. 17, they completed one of the last steps in the refugee vetting process: the medical exam. Mr. Sharif hoped to see them by Feb. 16, Nimo’s fourth birthday. His sister-in-law in Indianapolis has already bought them toys.

On Jan. 27 at 4:42 p.m., a week into his presidency, Mr. Trump threw the future of Mr. Sharif’s family into uncertainty when he signed the executive order barring refugees.

“My kids keep asking, ‘Daddy when are we coming?’”

Mr. Sharif has not told his children yet. “They cannot know,” he said. “I don’t want to make them hopeless.”