HANOI, Vietnam — Vietnam’s full-on war with the United States lasted a decade. Its tensions with its northern neighbor, China, have persisted for thousands of years — from a millennium of direct Chinese rule and a bloody border war in 1979 to more recent confrontations in the South China Sea.

If geography is destiny, then the fate of Vietnam is to be an expert in bargaining with Beijing and balancing between superpowers.

So with the rest of the world struggling to reckon with China’s assertive moves in the Pacific, the Vietnamese, hosts of this year’s Asia-Pacific Economic Cooperation forum, are offering guidance.

“I would like to give advice to the whole world, and especially to the United States, that you must be careful with China,” said Maj. Gen. Le Van Cuong, the retired director of the Institute of Strategic Studies at the Vietnamese Ministry of Public Security.