WASHINGTON — A day after accusing North Korea of “open hostility” and calling off a June 12 summit with its leader Kim Jong Un, President Donald Trump said Friday that talks with Pyongyang had resumed and expressed cautious optimism that the meeting could be held after all.

“We’ll see what happens. It could even be the 12th,” Trump told reporters as he left the White House to give the commencement address at the U.S. Naval Academy. “We’re talking to them now. They very much want to do it. We’d like to do it.”

The about-face was abrupt, even by Trump’s standards, and followed a conciliatory statement by Kim’s government saying it regretted Trump’s action and remained willing to talk. The President called it “a very nice statement.”

The exchange did little to clarify the highly charged situation, however, and instead underscored the mixed messages and unpredictability on both sides. They remain as far apart as ever on the central issue of North Korea’s nuclear arsenal: Trump demands Kim completely and irreversibly give up his program, while North Korea considers its weaponry and ballistic missile capability essential for its survival.

Officials cautioned that the latest burst of hopefulness does not ensure the summit will happen.

Asked by reporters Friday if he was optimistic, Defense Secretary James N. Mattis said, “I am optimistic that the diplomats are working, our diplomats are working very hard to make this happen.”

The most important factor in salvaging the summit may be the stake that both Trump and Kim have in holding a face-to-face meeting, even if it falls short of achieving a major breakthrough in long-hostile relations.

“Kim wants to meet with Trump to give him status. Trump wants to meet with Kim so he will be the center of global attention,” said Jon B. Wolfsthal, the director of the anti-proliferation Nuclear Crisis Group and a former Obama administration official.

The possibility that the summit will be saved likely reassured South Korea, whose president, Moon Jae-in, has worked fervently to coax Trump and Kim to the negotiating table. Moon, who had visited the White House only Tuesday to buttress the case for the Trump-Kim meeting, was taken by surprise by Trump’s cancellation two days later.

Mattis said diplomats were working to get the summit back on track. A White House advance team scheduled to go shortly to Singapore, the planned location for the summit, has not canceled its trip.

“We have got some possibly good news on the Korea summit,” Mattis said, calling the confusion between Trump and North Korea the “usual give-and-take.”

That description is contrary to the reaction of many diplomacy and national security experts, who have expressed consternation at the administration’s — and the President’s — erratic handling of the high-stakes dealings with North Korea. Analysts said that the back-and-forth over whether the meeting will occur should temper expectations about what the summit will achieve.

U.S. officials have called for North Korea to take unilateral steps to eliminate its nuclear arsenal and limit its ballistic missiles. But Pyongyang appears to favor phased concessions by both sides, with its gradual steps matched by U.S. economic assistance and assurances that it will not seek to oust Kim.

“Bridging this fundamental gap will be difficult if not impossible ... unless one or both sides align their expectations and rhetoric with this reality,” said Patricia M. Kim, an expert in Korean nuclear negotiations at the Council on Foreign Relations.

A senior administration official who briefed reporters on condition of anonymity Thursday outlined what he called “a trail of broken promises” from North Korea. Among then, Pyongyang’s team for negotiating summit details didn’t show up for a planning meeting with U.S. officials in Singapore less than two weeks ago, the official said.

“We weren’t getting the right signals previously, so hopefully we will in the future,” State Department spokesman Heather Nauert told reporters at the Naval Academy graduation ceremony. “But we didn’t want to go to a meeting just for the sake of going to a meeting. There had to be something to come out of it.”

Mattis said there had been no change in the U.S. military’s alert posture in response to the new uncertainty about the summit.

“We are not changing anything right now. It is steady as she goes,” Mattis said. “The diplomats are in the lead and in charge, and we give them our best wishes to have a fruitful way forward.”

Col. Chad Carroll, a spokesman for the U.S. military command in South Korea, said the next maneuvers involving U.S. and South Korean forces is scheduled for August. A major military exercise called Max Thunder finished Thursday.

“Diplomatic developments may ebb and flow, but one consistency is the military readiness of the U.S. and South Korea forces,” he said. “Our posture has been — and remains —steady and ready.”