BERLIN — The Nazi guard lived a quiet life in a racially diverse corner of New York City for decades, having lied on his United States immigration papers in 1949 about the type of work he did during World War II. But on Tuesday, he was deported to Germany, ending a 14-year battle to remove him from American soil.

The expulsion of the former guard, Jakiw Palij, rid the United States of the last known surviving Nazi war crimes suspect still residing in the country, bringing to a close a long-vexed effort by the government to deport him. It also handed President Trump, who had pressed strongly for Mr. Palij’s removal, a powerful talking point against critics of his immigration policies, by shifting the focus to the deportation of a man associated with the worst atrocities of the Holocaust instead of thousands of unauthorized immigrants whose stories are far more sympathetic.

Mr. Palij, 95, was first tracked down by investigators in 1993, and stripped of his American citizenship 10 years later when a federal judge found that he had falsely claimed in his visa application that he had worked on his father’s farm in Poland and at a German factory during the period when he was actually serving the Nazis at the Trawniki labor camp in occupied Poland.

On Tuesday, the White House announced that Mr. Trump had secured Mr. Palij’s deportation, dispatching immigration authorities to apprehend him and wheel him on a stretcher from his home in Queens to be taken by air ambulance to Düsseldorf. Mr. Palij, who is frail, arrived at Düsseldorf Airport early Tuesday and was taken by a Red Cross ambulance to a nursing home near Münster, in northwestern Germany.

Sarah Huckabee Sanders, Mr. Trump’s spokeswoman, said in a statement that “the United States will not tolerate those who facilitated Nazi crimes and other human rights violations, and they will not find a safe haven on American soil.”

The president used Mr. Palij’s deportation, which came one day after he saluted an Immigration and Customs Enforcement officer and border agents at the White House, as an opportunity to praise the agency, implicitly challenging those who would denounce it.

“President Trump commends his administration’s comprehensive actions, especially ICE’s actions, in removing this war criminal from United States soil,” Ms. Sanders said in her statement.

A few hours later, the Republican National Committee sent out a news release noting that Mr. Palij had lived in the congressional district where Alexandria Ocasio-Cortez, a rising star among Democrats who has called for the abolition of ICE, is seeking a House seat.

“Now that ICE has literally removed a Nazi from her backyard, where does Ocasio-Cortez stand?” wrote Michael Ahrens, the committee’s rapid response director.

At a campaign rally Tuesday night, Mr. Trump invoked Mr. Palij’s deportation during a screed against Democrats, who he said would throw open America’s borders and do away with ICE.

“The last known Nazi officer living in the United States, they’ve been trying to get him out for decades,” Mr. Trump said. “President Obama tried, they all tried. We got him out — gone. He’s back in Germany.”

Theodore Wold, a special assistant to the president for domestic policy, told reporters in a conference call that Mr. Palij’s removal was “part of the broader effort by the administration to take our immigration laws seriously and to address the comprehensive notion of citizenship.”

Mr. Trump had made Mr. Palij’s deportation a top priority, administration officials said, frequently raising his case with Chancellor Angela Merkel of Germany and asking Richard Grenell, the ambassador to Germany, to press the government in Berlin to accept him. Germany had long refused to do so because Mr. Palij is not a German citizen. Poland and Ukraine refused to take him, saying he was Germany’s responsibility.

“He made it very clear that he wanted this individual out of the U.S.,” Mr. Grenell said of Mr. Trump. Mr. Grenell said he had brought up the case at every meeting with German officials, beginning with his first conversation with Heiko Maas, the foreign minister.

At first, German officials did not appear to be aware of the case, Mr. Grenell said, but ultimately they were persuaded that taking Mr. Palij, though not legally required, was the right thing to do. He singled out Mr. Maas and Horst Seehofer, the interior minister, as particularly helpful.

Eli M. Rosenbaum, the director of the Justice Department office in charge of hunting and removing Nazis, said he could never have imagined, when his office began legal proceedings in 2002 to lay the groundwork for Mr. Palij’s removal, that he would ever see him deported, crediting the White House focus on the case with making a difference. He called the action “a landmark victory in the U.S. government’s decades-long quest to receive a measure of justice and accountability on behalf of the victims” of the Holocaust.

Thomas Yazdgerdi, the special envoy for Holocaust issues at the State Department, said the United States had been pressing Germany, Poland and Ukraine to accept Mr. Palij for more than a decade since his 2004 removal order, always without success.

Like other young men from Poland and Ukraine during the German occupation, Mr. Palij was trained by the SS, the Nazi paramilitary force, as an 18-year-old. He is believed to have served as an armed guard at Trawniki in 1943. On one day that year, more than 6,000 Jewish men, women and children died in the camp.

Mr. Palij has long denied participating in any killings, saying that he had merely guarded bridges and rivers. The SS forced him to work for them, he said, threatening to kill him and his family. “I know what they say,” he told The New York Times in an interview in 2003, “but I was never a collaborator.”

But the United States government determined in the early 2000s that as a guard aiding the SS at Trawniki he was.

Until Monday, he had been living in a two-story red-brick house in Queens. Jewish activists had frequently staged protests outside the home.

In his neighborhood, opinions about his deportation diverged sharply.

Maria Rososado, 70, who lives across the street, said she would often see Mr. Palij outside, cleaning his front yard and sidewalk. He mostly kept to himself, she said.

In the brief conversations she had with her neighbor, he appeared visibly sick, she said, and did not seem to have many years left. “He was just an old man,” she said. “He was not a bad person. He was a good neighbor.”

Adam DiFilippo, 33, whose stepmother is of Jewish descent, took a different view.

“This man deserves what he gets,” Mr. DiFilippo said. He said he learned of Mr. Palij’s past when students from a Jewish high school in Lawrence, N.Y., protested outside his home last November.

“This is New York City. We all have the freedom to be whatever we want,” he said, adding, “Just because you’re a New Yorker doesn’t give you the right to be a Nazi.”

Since 2005, the Justice Department has won deportation orders for 11 Nazi criminals, but only one of them had been successfully sent abroad: John Demjanjuk, a retired autoworker who had also served as a guard at Trawniki. He died in Germany in 2012, at the age of 91, before he could serve out his jail sentence for his role in the death of 28,000 people.

Katrin Bennhold reported from Berlin, and Julie Hirschfeld Davis from Washington. John Surico contributed reporting from New York.

A version of this article appears in print on , on Page A14 of the New York edition with the headline: U.S. Deports the Last Nazi Suspect After 14 Years of Trying. Order Reprints | Today’s Paper | Subscribe