By Matthew Tostevin
HANOI (Reuters) - Vietnam could hardly have asked for more: a U.S. warship challenging Chinese claims in the South China Sea, a meeting at the White House and six new coastal patrol boats.
All are signs of a U.S. commitment which Vietnam had feared was waning under President Donald Trump just as the Southeast Asian country has emerged as the most forceful opponent of China's claim to one of the world's most important seaways.
But uncertain over how enduring U.S. support will be and wary of relying on any ally, Vietnam is just as carefully cultivating ties with ancient foe China.
"Vietnam doesn't want an imbalance of power in the region that could lead to war," said Tran Cong Truc, a former head of the National Boundary Commission who spent decades defending Vietnam's maritime claims.
The meeting with Trump next Wednesday is a coup for Prime Minister Nguyen Xuan Phuc, who will be the first Southeast Asian leader to visit the White House under the new administration.
It reflected calls, letters, diplomatic contacts and lower level visits that started long before Trump took office in Washington, where Vietnam retains a lobbyist at $30,000 a month.
Just as important symbolically for Vietnam this week was having a U.S. warship sail close to an artificial island being built by China in the South China Sea, where Beijing's extensive claims are disputed by Vietnam and four other countries.
Vietnamese officials and foreign envoys familiar with Hanoi's position said it had been lobbying hard for what former enemy the United States calls a "freedom of navigation" mission.
Further underlining U.S. support, the United States delivered six coastal patrol vessels to Vietnam this week.
"Vietnam's future prosperity depends upon a stable and peaceful maritime environment," U.S. Ambassador Ted Osius said.
Such words help to ease concerns in Vietnam at being a lonely voice in challenging Beijing in the South China Sea, particularly since Philippine President Rodrigo Duterte has grown closer to China.
Military ties between the United States and Vietnam were forged under the Obama administration, but even more important was the strategic Trans-Pacific Partnership (TPP) trade pact.
Vietnam was disappointed when Trump ditched that deal and focused trade policy on reducing deficits - Vietnam's $32 billion surplus with the United States was the sixth biggest last year.
Vietnamese nerves were jangled further by Trump's recent coziness with Chinese President Xi Jinping in trying to tackle North Korea's nuclear program.
"The total fixation on North Korea had Vietnam quite worried that the South China Sea would be left wide open," said Carl Thayer, a Vietnam expert at Australia’s University of New South Wales.
In Washington, State Department spokeswoman Katrina Adams said "the U.S.-Vietnam partnership is a critical component of U.S. foreign policy in the Asia-Pacific region".
But a former senior U.S. official said Trump could be expected to complain to Vietnam's prime minister about the size of its trade surplus. Under Trump budget plans, Vietnam could also find U.S. military donations becoming loans instead.
In the face of the uncertainty since Trump took office, Hanoi has been paying as much attention to Beijing as to Washington.
President Tran Dai Quang combined a state visit with his attendance at China's Belt and Road summit. Communist Party chief Nguyen Phu Trong, arguably the most powerful man in Vietnam, was in Beijing days before Trump's inauguration.
After both those visits, the countries emphasized their readiness to keep the peace in the South China Sea, through which some $5 trillion in trade flows each year.
Just as telling, the Vietnamese coast guard sent a vessel on a visit to China for the first time early this month.
"'Simultaneously cooperate and fight' is a very practical policy," said Truc. "Vietnam never kneels or surrenders before China's open violation of its legitimate rights, but it does not give China any excuse to use its power to create conflict."
For graphic on rival claims in the South China Sea, click: http://tmsnrt.rs/1GHW1LC
For graphic on U.S.-Vietnam trade, click: http://tmsnrt.rs/2r1vBEH
(Additional reporting by Mai Nguyen in Hanoi, Greg Torode in Hong Kong, David Brunnstrom and Mike Stone in Washington; Editing by Nick Macfie)