HANOVER, Germany — The United States will significantly increase the number of military personnel, including Special Forces, in Syria to fight the Islamic State, President Obama said on Monday as he concluded a six-day trip to the Middle East, Britain and Germany.
Mr. Obama, whose comments came in a speech in which he pressed for European unity, said that he would add 250 military personnel to the 50 already on the ground in the hopes of cementing what he said was progress in pushing back the Islamic State, also known as ISIS or ISIL, from territory that it had held.
“They’re not going to be leading the fight on the ground,” Mr. Obama said, confirming a recent report in The New York Times, “but they will be essential in providing the training and assisting local forces.”
In the 49-minute speech, Mr. Obama urged Europeans to remain united in the face of growing economic and security threats, saying that the dangers of inequality, terrorism, prejudice and injustice would drag down the United States and Europe if countries on both sides of the Atlantic do not continue to work together.
Mr. Obama told an audience of business leaders, politicians and students that Europe must not let itself be pulled apart by those who fear cooperation.
“Dangerous forces do threaten to pull the world backwards, and our progress is not inevitable,” Mr. Obama said in one of his final trips to Europe as president. “We are not immune from the forces of change around the world.”
Mr. Obama has spent much of his visit to Europe urging the British people to vote to remain in the European Union in a referendum on June 23. He said repeatedly over the past week that leaving the 28-member bloc would undercut Britain’s influence and weaken the democratic alliance that binds Europe.
In his speech on Monday, Mr. Obama went further, arguing to members of the predominantly German audience that they, too, must resist the temptation to go it alone in fighting the Islamic State, pushing for economic security and confronting the huge new flows of migrants.
“If we do not solve these problems, you start seeing those who would try to exploit those fears and frustrations and channel them in a destructive way,” Mr. Obama said in comments that appeared to refer, at least in part, to Donald J. Trump, the leading candidate for the Republican presidential nomination.
Support for populist and nationalist movements has grown in Europe in recent months, with the most recent example coming on Sunday in Austria, where a member of the far-right Freedom Party finished on top in the first round of voting for the country’s largely ceremonial presidency.
Reflecting on the dangers to the political situation, Mr. Obama quoted the Irish poet William Butler Yeats in saying that they lurk where “the best lack all conviction, while the worst are full of passionate and intensity.”
That kind of destructive politics must not take root in Europe, Mr. Obama said, or there would be damaging consequences for the United States and many other nations around the world.
“If a unified, peaceful, liberal, pluralistic free-market Europe begins to doubt itself, begins to question the progress that’s been made over the last several decades, then we can’t expect the progress that is just now taking hold in many places around the world will continue,” he said.
Mr. Obama’s warnings against unilateral actions were clearly intended to steer Europe away from nationalist or isolationist stands. But, in fact, his close ally, Chancellor Angela Merkel of Germany, has found herself isolated in the European Union for refusing to meet calls from other countries or from her conservative bloc to put an upper limit on the flow of migrants.
Ms. Merkel put together a deal between Turkey and the European Union in March that gave a veneer of unity to the Continent’s very mixed response to arriving refugees and migrants. That deal remains the subject of intense debate in light of Turkey’s current crackdown on the news media and on other freedoms.
The accord has succeeded in sharply reducing the migrant flow, but only in tandem with an earlier decision by Austria and Balkan states to close their land borders and shut off the route favored by approximately one million migrants last year.
Mr. Obama also gently chided the Germans and other European nations for not always carrying a fair share of the financial and military burden as part of the NATO alliance.
Those comments echoed remarks the president made recently in The Atlantic, where he referred to some European leaders as “free riders” who relied too heavily on the United States to pay for their military defense and to wage the fight against extremism.
He said he would go to the NATO meetings in Europe this summer and would demand that every nation contribute 2 percent of its gross domestic product to the defense of the Continent.
“We can’t deal with these challenges by ourselves,” Mr. Obama said.
For much of the speech, the American president lavished praise on Europe, citing what it has achieved. He said that Europeans should not take for granted the democratic societies they have built or the major wars they have avoided in the past several decades.
“Perhaps you need an outsider, somebody who’s not a European, to remind you of the magnitude of what you’ve achieved,” he said, adding that the European Union “remains one of the greatest political and economic achievements of modern times.”
But he also cautioned that confronting the very real issue of economic inequality would require unity and more cooperation, not the erection of new barriers.
“The answer to reform is not cutting ourselves off from each other,” he said.