MANILA — Military and diplomatic officials in the Philippines were facing a quandary on Thursday after President Rodrigo Duterte distanced the country further from the United States, its biggest defense ally, by saying he would end joint military exercises like one scheduled for next week and would pursue closer ties to China and Russia.

Speaking to Filipinos in Vietnam late Wednesday, Mr. Duterte said that although he was preserving the 65-year military partnership between Manila and Washington, he was eager to strengthen relations with powers closer to home.

He said that Russia, where Philippine diplomats recently held embassy-level talks on procuring military hardware, had invited him to visit.

“So, I am serving notice now to the Americans and those who are allies,” he said. “This will be the last military exercise. Jointly, Philippines-U.S., the last one.”