But observers expect that Vietnamese carriers will err on the side of caution when they sign commercial 5G agreements. China and Vietnam fought a brief but bloody war 40 years ago, and Hanoi has watched warily as its northern neighbor’s wealth and military ambitions have grown ever since.

“The whole world needs to be careful with China,” said Maj. Gen. Le Van Cuong, the former director of the Institute of Strategic Studies at the Vietnamese Ministry of Public Security. “If a superpower like America regards China as a cybersecurity threat, then of course Vietnam has to.”

Huawei has long denied that it takes orders from Beijing or that its products are a security risk.

“Vietnam has not been a strong 4G market for Huawei, and we have modest ambitions for 5G there,” said a company spokesman, Joe Kelly.

Mobile internet coverage has increased quickly in Vietnam, and the government is in a hurry to develop its networks further. Today, even remote mountain, coastal and island communities have 4G. Vietnamese leaders say they want 5G connections ready next year, hoping that ultrafast internet will give a jolt to economic development.

But the country’s sour recent relations with Beijing may have made officials nervous about entrusting the task to Chinese companies. Although the two nations see eye to eye on censoring and controlling the internet, they have been at odds for years over territory in the South China Sea, which Vietnam calls the East Sea. After China placed an oil rig off Vietnam’s coast in 2014, marauding crowds of Vietnamese workers stormed factories and attacked Chinese laborers.

In response, Hanoi has cautiously cultivated closer ties with Washington. Still, China is Vietnam’s largest trading partner, and Chinese companies have brought in capital and job opportunities. Living in China’s backyard means Vietnam must keep its powerful neighbor close, but not too close.