Malaysia and the Philippines’ rapprochement with China is the result of temporary alignment of interests.

“We will be signing many new agreements and understandings that will elevate the relationship between our two nations to even greater heights,” declared Malaysian Prime Minister Najib Razak shortly before his visit to Beijing. Moving a step further, the Southeast Asian leader praised how China has “created benefits not just for the people of our two nations but also for regional stability and harmony”.

Days later, Najib warned the West against “lectur[ing] countries they once exploited on how to conduct their own internal affairs today”.

Najib’s statements were particularly significant, because they came shortly after the Philippines’ controversial leader, Rodrigo Duterte, visited Beijing, where he uttered a similar mixture of praises for his hosts and derision for the West, specifically the United States.

Both the Philippines and Malaysia have also signed defence agreements with China.

Manila is exploring a 25-year military deal, which allows it to purchase Chinese weapons on favourable terms, while Kuala Lumpur has bought patrol naval vessels from Beijing.

This is a dramatic turn of events, since not only are the Philippines and Malaysia considered as staunch strategic partners of the West, but they have also been caught in bitter territorial disputes with China, which has rapidly expanded its footprint across the South China Sea.

Put together, Najib’s and Duterte’s back-to-back visits to Beijing have provoked panic in some western capitals, with observers causally warning about a wave of defections among traditional western partners now pivoting to China.

There are fears that the United States’ regional allies are falling like a domino to an ascending strategic rival, China, which has offered billions of dollars in economic incentives and (supposedly) shunned criticising domestic policies of neighbouring states.

A more careful analysis, however, reveals that what we are instead witnessing is an ephemeral strategic recalibration among US allies, who seek to maximise their own room for manoeuvre.

Show me the money

Several factors explain the Philippines’ and Malaysia’s strategic flirtation with China. The most obvious one is, of course, commercial considerations. Throughout the past decade, China has emerged as the top-trading partner of almost all regional states, with the exception of the Philippines ( PDF ).

But the Asian juggernaut lagged behind traditional powers such as Japan and the US in terms of direct investments. In recent years, however, China has been rapidly closing the gap , offering large-scale investments across its near abroad.

The Philippines' and Malaysia's tilt to China isn't necessarily an indication of failure in the US' pivot to Asia strategy. If anything, recent developments may represent a temporary coup de grace after a series of strategic setbacks for China.

By successfully setting up the Asian Infrastructure Investment Bank (AIIB), and relishing the dramatic expansion of state-affiliated telecommunication companies like Huawei and ZTE, Beijing is in a strong position to become the key source of infrastructure development across Asia.

Rising labour costs at home also mean that Chinese manufacturers are in search of cheaper alternatives in Southeast Asia. During their visit to China, Duterte and Najib secured tens of billions of dollars in investment pledges and business deals.

China is expected to help build a $15bn high-speed rail project linking Kuala Lumpur and Singapore. It could also play a critical role in revamping the infrastructure landscape in Mindanao, Duterte’s home island, which has been racked by insurgency and massive poverty in recent decades.

Seeking compromise

There were also realpolitik considerations. Uncertain about the US’ commitment to the region, both Manila and Kuala Lumpur have sought direct engagement rather than confrontation with the Asian powerhouse over the South China Sea disputes.

Duterte has barely mentioned the Philippines’ landmark arbitration case against China in either international forums or during his recent state visit to China. A negotiated compromise like joint development agreements in contested waters seems to be the preference of both the Philippines and Malaysia.

Chinese President Xi Jinping, right, gestures to Philippines President Rodrigo Duterte during a review of the guard of honour during a welcome ceremony [EPA]

A more important but less discussed factor is the US’ criticism of Duterte’s war on drugs and Najib’s potential problem with judicial authorities over a massive corruption scandal . Both leaders are trying to deter further American criticism by dangling the “China card”.

This way, they hope to expand their room for manoeuvre and avoid any legal and political showdown with Washington.

Their tirades against Western interference and imperialism as well as praise for China, which has kept quite on their domestic politics, should precisely be understood in this context.

Shifting sands

The Philippines’ and Malaysia’s tilt to China isn’t necessarily an indication of failure in the US’ pivot to Asia strategy. If anything, recent developments may represent a temporary coup de grace after a series of strategic setbacks for China.

In recent years, China has painfully watched former allies such as Myanmar and Communist sisters like Vietnam rebuild ties with the West, particularly the US.

OPINION: China rolls out the red carpet for Rodrigo Duterte

In fact, Hanoi is considering buying advanced weaponry from and conducting more regular joint exercises with the US, which has regained potential access to Cam Ranh Bay for the first time since the end of Cold War.

In fact, even staunch Chinese allies such as Laos have begun to reconsider their lopsided relationship with China in favour of better ties with the West.

Meanwhile, after an initial spark, China’s relations with South Korea have rapidly soured in recent years. Even relations with North Korea, an erstwhile ally, is in the doldrums .

To Beijing’s consternation, Taiwan is now under the rule of a pro-Independence party , which is doubling down on defence cooperation with the US, Japan and other Western partners.

In short, strategic alignments in Asia seem to be more fluid than unidirectional. Much will also depend on the result of the US election and the policies of the new incoming administration.

For now, China can at least relish revived relations with bitter rivals in the South China Sea.

Richard Javad Heydarian is a specialist in Asian geopolitical/economic affairs and author of Asia’s New Battlefield: The USA, China, and the Struggle for the Western Pacific .

The views expressed in this article are the author’s own and do not necessarily reflect Al Jazeera’s editorial policy.