The president came away from the NATO gathering having made some progress on both fronts, albeit incremental. He won broad expressions of support and some specific pledges of help from allies for confronting the ISIS threat, and agreement by NATO to provide military assistance to Iraq if asked to — but no firm commitment from allies to join a combat mission against the militant group on either side of the vanishing border between Iraq and Syria.

Image President Obama during a news conference in Tallinn, Estonia, on Wednesday. Credit... Doug Mills/The New York Times

Similarly, while he found agreement with European leaders to go forward with new sanctions against Russia that had been under discussion before the summit, and NATO agreed to assist Ukraine with nonlethal security equipment, there appeared to be no appetite either by Mr. Obama or his European counterparts for arming the Ukrainians.

And NATO’s decision to create a modest rapid-reaction force was more an effort to deter Russia from further meddling in the region than to solve the current problem in Ukraine.

Mr. Obama’s four-day trip was bookended by attention-grabbing moves by both Russia and ISIS. The videotaped execution of the American journalist Steven J. Sotloff — the second such killing of an American that ISIS had carried out and publicized — was a keen reminder that the group is a continuing threat, and intensified pressure on the president to expand Iraqi airstrikes against the group into Syria.

And even as Mr. Obama was preparing to speak in Tallinn, Mr. Putin flirted publicly with the idea of a cease-fire with Ukraine, then backed away, only to return to the idea by weeks’ end, just as American and European officials announced they would impose another round of sanctions.

Mr. Obama used the trip to sketch out his vision for how NATO can redefine itself and stay relevant in a world destabilized by Russia, and increasingly by extremists in the Middle East and North Africa.

“This is a step back and a reflection and a diagnosis of opportunity for the alliance,” said Mr. Obama’s ambassador to NATO, Douglas E. Lute. “This is a bit of a point of, step back, look at what’s happening immediately on NATO’s borders, and then let’s figure out what we can do about it.