Mahathir Mohamad, the anti-China rebel of Southeast Asia?

Not quite, if the reaction of foreign-policy observers to the Malaysian leader’s five-day visit to China is anything to go by.

The 93-year-old leader’s trip had attracted intense scrutiny for any residual signs of the anti-Beijing hawkishness he had shown in the run-up to his shock election victory in May.

Close watchers of Malaysia-China ties said the visit had been a success and that both sides had shown an eagerness to “meet halfway” and put behind them the uncertainties that had built since Mahathir defeated his Beijing-friendly predecessor Najib Razak.

Immediately after the May 9 election, Mahathir had sparked anxiety in Beijing policymaking circles with his snap decision to suspend some US$22 billion of Chinese-backed infrastructure projects endorsed by his predecessor that he felt were unnecessary and too expensive.

And his public position on China before the election had been even more alarming for China’s leaders – at one point during his campaign he blasted his one-time protégé Najib for ceding sovereignty to Beijing.

What Malaysia’s ‘Mahathir doctrine’ means for China-US rivalry

But Mahathir struck a far more amiable tone in his five-day visit, which saw him tour the offices of Alibaba Group Holding (the owner of the South China Morning Post), carmaker Zhejiang Geely and drone maker DJI as well as meet President Xi Jinping, Premier Li Keqiang and National People’s Congress chairman Li Zhanshu.

As he departed for Kuala Lumpur on Tuesday, Mahathir reiterated his intention to cancel the projects – a decision he said Chinese leaders had assented to – but stressed he was doing so purely because Malaysia could not afford them, and not to spite Beijing.

Mahathir’s government came to power on a platform that accused Najib, embroiled in the multibillion-dollar 1MDB scandal, of taking the country to the verge of bankruptcy.

“It is not about the Chinese,” the veteran politician repeated several times during his visit.

Mahathir’s efforts appear to have gone some way to assuaging Chinese concerns.

Chinese project negotiations stall as Mahathir wraps up Beijing visit

Following his trip, China said it would take a “long-term” view to resolving any underlying tensions.

“[When] two countries cooperate, it is unavoidable that various problems may emerge and we may adopt different views at different times,” said China’s foreign ministry spokesperson Lu Kang.

“We should approach these problems through friendly negotiations with the purpose of maintaining friendly ties and adopting a long-term view,” he said.

“I can tell you that this is an important consensus reached during this visit by Malaysian Prime Minister Mahathir.”

Shahriman Lockman, a senior analyst with the Kuala Lumpur-based Institute of Strategic and International Studies, said the outcome of the visit was “as good as it gets”.

‘We like rich partners’: Malaysia’s Mahathir heads to China for fence-mending trip

“I think Mahathir got the maximum that we could have expected from his visit,” he said. “It looks like the Chinese met him halfway by expressing their understanding of Malaysia’s economic situation while leaving specific details of the project negotiation to the officials and the Chinese companies concerned. Overall this was a win for Mahathir.”

Awang Azman Awang Pawi, a politics professor at the University of Malaya, said one of the trip’s “victories” was the returning premier’s ability to convince the Chinese he was acting solely to prevent the country slipping into bankruptcy.

“China was made to understand the problems Malaysia is facing after the Najib administration left after incurring a huge national debt,” he said. “China understandably would not want Malaysia to become bankrupt.”

And Abdul Majid Ahmad Khan, the chairman of the Malaysia-China Friendship Association and a former Malaysian envoy to Beijing, said both sides had showed pragmatism by agreeing to cooperate in several areas including currency swaps, e-commerce and enhanced trade of Malaysian agricultural products.

As Wang Yi meets Mahathir Mohamad, fears for China-Malaysia ties ease

Zhang Mingliang, a Southeast Asia specialist with Jinan University, said both sides had been pragmatic by avoiding “talking about the deals and the South China Sea”.

Zhang said Beijing was probably still eager to get Malaysia back on board with the projects amid a series of worldwide setbacks for China’s “Belt and Road Initiative”.

“There are not many countries like Malaysia which not only vocally support the initiative but also worked together with China on [infrastructure] projects,” he said. “Malaysia’s cancelling of the projects will have a negative impact on the reputation of the Belt and Road.”

Still, China’s roll-out of the red carpet for Mahathir was indicative of its eagerness to “flatter him,” according to Shahriman from the Institute of Strategic and International Studies.

As Malaysia’s leader touched down in Beijing on Saturday night, he was greeted by foreign minister Wang Yi, a gesture usually reserved for heads of governments.

President Xi, meanwhile, hosted a banquet for Mahathir, a task usually handled by the Chinese premier for visiting prime ministers.

“The optics were good. The Chinese were obviously out to flatter Mahathir,” Shahriman said.

100 days of Mahathir, 2 in 10 pledges met. Satisfied, Malaysia?

Other analysts said Mahathir’s trip showed a more nuanced position on China following his election victory.

Mahathir’s multiracial alliance may have used China as a bogeyman in campaigning – much as Najib’s Malay-dominated Barisan Nasional coalition once did with local Chinese – but that strategy needed to be squared with post-election economic realities, observers said.

“Since the election, Mahathir and other government figures have been at pains to explain that the anti-China election campaign was in fact directed at Najib, and not China,” said Amrita Malhi, an Asian politics researcher at the Australian National University.

Mahathir’s change of tack was likely to go down well with his Pakatan Harapan alliance’s base, Malhi said.

“The idea of resetting the Malaysia-China relationship so it becomes about growth and opportunity – as opposed to debt and corruption which he has associated with Najib – is appealing to voters who feel they’ve been going under, because of the pressure exerted on them by corruption, inadequate social protections, and the cost of living.”

But even as the recent anxieties dissipated, sticky issues like the South China Sea dispute needed attention, Shahriman said.

Mahathir has said he would prefer Chinese warships to stay out of the disputed waters, but observers said he, like Najib, was unlikely to be too hard on Beijing on the matter – despite the fact that large Chinese coastguard vessels resembling warships have been patrolling waters claimed by Malaysia as its sovereign territory.

Beijing claims almost all of the South China Sea under its controversial nine-dash line boundary.

In their joint statement on Tuesday, the two countries said they would continue to work towards enacting a code of conduct for the waters.

Another potential issue both sides needed to work on, analysts said, was maintaining trade volume.

Malaysia has been China’s largest Southeast Asian trading partner for nine years, though that mantle could soon be usurped by Vietnam.

With additional reporting by Catherine Wong