For decades, each time a new Burmese military chief of staff was appointed, like clockwork, he would make his first foreign trip to Beijing, his nation’s firmest diplomatic ally and longtime economic bulwark.

But Gen. Min Aung Hlaing, currently on a visit here, was busy in some unusual places before he came to China. Earlier this month he was talking to the special US envoy to Burma, Derek Mitchell. Then he went to Vietnam. He will be back home later this week when Hillary Clinton makes the first visit to Burma by a US Secretary of State since 1955.

The fact that General Hlaing chose Vietnam, a near neighbor building closer military ties with Washington and making no secret of its nervousness about China’s regional ambitions, has not gone unnoticed in Beijing.

Chinese Vice President Xi Jinping welcomed Hlaing to Beijing with a reminder that the two countries’ friendship had “endured the test of time through sudden international changes.”

Burma appears in the midst of such a change now, as the new nominally civilian government that took over the reins from the military last March releases political prisoners, reaches out to ethnic minorities to end years of violence, and tests a political opening in talks with opposition leader Aung San Suu Kyi.

China has been a lifeline for Burma, ruled by military dictatorships since 1962 and especially isolated since most nations slapped sanctions on the government after it cracked down brutally on a pro-democracy uprising in 1988.

Now “we want to have a regular relationship” with the United States, the powerful speaker of the Burmese parliament and former member of the military junta Shwe Mann told reporters on Friday.

The government’s foreign policy would be based on “peaceful coexistence with all nations,” Mr. Mann said, insisting that “there is no reason to have worse relations between Myanmar and China when Myanmar and US relations get better.” Myanmar is the government’s official name for Burma.

Such a policy would mark a return to Burma’s traditional neutrality, an understandable approach given the country’s sensitive geographical location, squeezed between Asia’s two giants, India and China, and flanked by Thailand, a strong US ally.

Since international sanctions isolated the country, Burmese governments have had little option but to depend on China for trade, weaponry, and diplomatic support in the United Nations. Chinese businesses, private and state owned, have poured $12.3 billion into Burma, and hundreds of thousands of Chinese have settled in Burma.

There had been signs even before the military stood down that nationalist generals were unhappy with this state of affairs. Now the new government, dominated by former senior military men who have swapped their uniforms for suits, has stepped away from China in symbolic ways.

Most notable was the decision last September to suspend a $3.6 billion Chinese dam construction project in northern Burma that had sparked considerable local opposition. Of the hydropower due to be generated by the Myitsone dam, 90 percent was to be sent to China.

Though the new Burmese authorities appear keen to re-orient the country’s foreign policy, few observers expect them to cast off ties with their powerful and influential leader. Rather, they will walk a tightrope between Washington and Beijing.

“It would be insane to think that Burma needs to choose one over the other,” prominent Burmese historian Thant Myint-U recently told The Irawaddy, an independent online newspaper published by Burmese exiles. “Burma is the last country that can afford to have bad relations with either the US or China.”