President Obama left for Europe on Monday intending to spank Russia for causing a crisis in Ukraine while on his tour. He was leaving Friday night a little more optimistic that the situation could be resolved diplomatically.

On the sidelines of a D-Day lunch for about 20 heads of state hosted by French President François Hollande, Obama spent 15 minutes talking with Russian President Vladimir Putin about the situation in Ukraine. Earlier, Putin had a brief meeting with Ukrainian President-elect Petro Poroshenko, who will be inaugurated Saturday.

The meetings did not lead to any breakthroughs. But before departing to return to the United States after the four-day trip, U.S. officials said they saw the discussions as productive.

The Putin-Poroshenko discussion was “a positive development,” a senior administration official said, adding that Obama and his team are “more optimistic” about the situation in Ukraine.

Putin’s decision Friday to engage directly with Poroshenko, a late invitee, suggested that he might be open to dealing with, or even officially recognizing, the new government.

Putin told reporters that Russia was prepared to work to improve relations with Ukraine. He added that Poroshenko’s “determination in general looked right to me, and I liked it.”

“I hope the things will go exactly this way, and if this happens, then conditions will also be provided for the development of our relations in other fields, including the economy,” Putin said, in remarks broadcast live on Russian television.

He plans to send Russia’s ambassador to Ukraine to the inauguration Saturday and has said he is ready for dialogue with Poroshenko.

However, Putin said a week ago that he still regards Viktor Yanukovych, who was ousted as president in February amid popular protests and fled to Russia, as the legitimate leader of Ukraine.

Poroshenko told reporters that he expected Russia to formally recognize Ukraine’s May 25 presidential election, Interfax reported.

Poroshenko also said that he expected talks between Russia and Ukraine to begin in Kiev on Sunday, a day after his inauguration.

Ben Rhodes, deputy national security adviser for strategic communications, said Obama told Putin that in addition to recognizing the Poroshenko government, he must also end his support for separatists stirring unrest and violence in eastern Ukraine and stop permitting the transfer of arms and materiel across the border.

“President Obama underscored that the successful Ukrainian election provides an opportunity that should be taken,” Rhodes said. “If Russia does take this opportunity to recognize and work with the new government in Kiev, President Obama indicated that there could be openings to reduce tensions.”

The United States and European allies have put in place a range of economic sanctions targeting Russian companies and individuals that U.S. officials say have harmed Russia’s economy. Officials continue to consider broader, more painful sanctions that target entire sectors of the Russian economy, though getting Europeans on board with such measures may be a challenge because their nations are vulnerable to economic side effects.

Russia’s actions have resulted in its effective expulsion from the Group of Eight leading industrialized nations, which met this week in Brussels as the Group of Seven. At the two-day meeting, leaders warned Russia that if it does not take steps to de-escalate the Ukrainian crisis, it could face even harsher economic sanctions.

And earlier in the week, Obama, in Poland to reassure Eastern Europe that the United States still stands by its side, said the Russian president “was harnessing dark tactics of the 20th century” through his actions in Ukraine and perceived threats to Eastern Europe.

It has been known for some time that Obama and Putin, leaders of nations that were the two main victors of World War II, might cross paths on the 70th anniversary of D-Day. But the White House did not say in advance whether the two would talk at the luncheon, and for a time Friday it did not appear that they would.

As reporters traveling in the presidential pool were briefly brought over to observe the world leaders at the Chateau de Benouville, Obama and Putin seemed to be avoiding each other.

Obama warmly greeted other leaders and kissed German Chancellor Angela Merkel on both cheeks, then lingered talking to Queen Elizabeth II in a way that appeared as though he was avoiding Putin. At one point, Obama was directly behind Putin but focused his attention elsewhere.

At the lunch table in the chateau, Hollande was seated at the center, with Queen Elizabeth to his right and Obama to her right. To Hollande’s left was Queen Margrethe II of Denmark, and to her left was Putin.

Birnbaum reported from Moscow.