Da Nang, Vietnam (CNN) President Donald Trump and Russian President Vladimir Putin informally met on the sidelines of a regional economic summit in Vietnam Saturday and agreed to an extensive statement on the conflict in Syria.

The statement, which reaffirms the leaders' commitment to defeat ISIS in the country, stresses the need to keep existing military communications open and agrees that the bloody conflict does not have a military solution.

"President Trump and President Putin today, meeting on the margins of the APEC conference in Da Nang, Vietnam, confirmed their determination to defeat ISIS in Syria," the statement reads, adding later that Trump felt he had a "good meeting with President Putin."

While the statement mostly addresses long-accepted areas of agreement between the United States and Russia, it comes after Trump and Putin spoke casually at least three times at the ocean-side summit in Da Nang on Friday and Saturday.

A senior State Department official told reporters they were optimistic the US-Russian diplomacy would be met with more success than the past because of the changing landscape in Syria.

"Russia got themselves involved back when it was a civil war. In some respects, the effort to defeat ISIS changed priorities for some," the official said. "Certainly, for us, the priority was defeating ISIS. I think for Russia, it's a question of how long do they want to continue to support conflict."

"What the joint statement indicates is a commitment to get this to a political reconciliation and peace process. That serves their interest, it serves our interest," the official said.

Asked if Russia has enough influence to bring Syrian leader Bashar al-Assad to the table, the official said: "We're going to be testing that, we're going to find out."

The White House said Trump and Putin spoke for about five minutes in between events at the Asia-Pacific Economic Cooperation summit. The most extensive conversation observed by reporters came as the two leaders shared a friendly, yet brief, walk to a photo op in between meetings on Saturday. The two leaders looked comfortable together and smiled as they talked.

Trump, speaking with reporters aboard Air Force One on Saturday, said the agreement is "going to save tremendous numbers of lives."

Describing his interactions with Putin, Trump said that they got along well and agreed to the joint statement "very quickly."

"We seem to have a very good feeling for each other, a good relationship considering we don't know each other well," Trump said. "I think it's a very good relationship."

According to the joint statement, Trump and Putin "agreed to maintain open military channels of communication" between the two countries on Syria and said their efforts would continue "until the final defeat of ISIS is achieved."

"The Presidents agreed that there is no military solution to the conflict in Syria," the statement said, adding that the two agreed to find an "ultimate political solution" to the conflict.

Senior State Department officials later told reporters that the statement was the product of "intense, difficult" negotiations over the past several months, led by Secretary of State Rex Tillerson along with Pentagon officials. The officials said that the defeat of ISIS and reduction of the terror group's caliphate was going well and that the de-escalation zones implemented in gradual phases had resulted in a significant reduction in the violence and helped save many lives.

The officials said the agreement marked Russia's firmest commitment yet to a new constitution and free elections in Syria through a UN-led process.

The results of the Trump-Putin meeting in Vietnam mirror what happened when the two world leaders met for the first time in Germany earlier this year.

Though Russia's interference in the 2016 election was discussed, the two leaders also agreed to a ceasefire in southwest Syria, too.

"This is our first indication of the US and Russia being able to work together in Syria," Tillerson said at the time.