Samsung has achieved something that Tim Cook, chief of its arch-rival Apple, has suggested would be all but impossible: it has moved its smartphone manufacturing out of China.

At the end of last month, the South Korean electronics group, quietly closed its last remaining Chinese smartphone plant in Huizhou, Guangdong, handing out gifts of its flagship Galaxy S10 and Note 10 phones, along with some cash bonuses, to long-serving employees.

The departure of the world’s largest smartphone maker was the latest blow to China’s long dominance in high-end manufacturing, as wages rise and the threat of US tariffs weighs on other companies, such as Apple.

As recently as two years ago, the Huizhou plant’s 6,000 workers were still making 63m phones, or 17 per cent of Samsung’s global production, according to analysts.

But its closure, alongside plants in Tianjin and Shenzhen, is the culmination of a decade-long strategy by Samsung to “diversify the risks of its manufacturing bases”, according an executive at the South Korean company.

Lured by cheaper labour costs and huge tax breaks, Samsung built its first smartphone plant in Vietnam’s Bac Ninh province in 2008 for $2.5bn and another in the country’s Thai Nguyen province in 2013 for $5bn.

Those two plants have a combined annual capacity of 150m units, and make roughly 60 per cent of Samsung’s phones. Last July, Samsung announced that it would create the largest mobile phone factory in the world in Noida, India.

As it moved capacity elsewhere, Samsung kept its Chinese production to serve the China market. But it has seen its share evaporate to 1.1 per cent in the first quarter from about 20 per cent in 2013, according to Strategy Analytics, removing the final barrier to closing its factories there.

“Samsung did not pay enough attention to the particularity of the Chinese market,” said Yanhui Wang, secretary-general of the Mobile China Alliance.

“Our market share in China has dropped so much . . . We used Chinese production for overseas sales as well in the past but its competitiveness as a global manufacturing base has decreased,” said the Samsung executive.

Samsung struggled to balance its global dominance of the smartphone market with the local customisations that appeal to Chinese consumers.

Although Samsung and its Chinese competitors all use Google’s Android operating system, domestic phonemakers like Huawei and Xiaomi have been more adept in building up their own alternatives to Google’s Play app store and other services that are blocked in China.

“The reason that Samsung entered China was its huge market and cheap cost, but the two factors are gone now,” said CW Chung, head of research at Nomura in Seoul.

Samsung is still investing heavily in its memory chipmaking plant in Xian, to which Chinese premier Li Keqiang made a surprise visit this week, saying he “welcomes increased investment in China by Samsung and other global high-tech companies”.

While Samsung will continue to produce some lower-end smartphones in China through contract manufacturing, higher-end devices such as the S10 will now all be made in Vietnam.

Most of the value that Chinese phone factories add is in low-skilled manual assembly, meaning that rising labour costs have eroded China’s competitive advantage, said Huang Weiping, professor of economics at Renmin University in Beijing.

“The problem with making smartphones in China is that there are few components that China can supply, and those are cheap. As for assembly labour, China no longer has the cost advantage,” Mr Huang said. Analysts say wages in China are twice as much as in Vietnam and several times that of similar workers in India.

But supply chain experts said that other smartphone makers, unlike the vertically integrated Samsung which makes it owns components and assembles them in-house, are unlikely to be able to move away from China, even as wages rise.

Companies like Apple, which rely on contract manufacturing rather than running their own factories, have spent decades investing to educate their suppliers’ workforce in China, says Paul Stepanek, president at Complete Manufacturing and Distribution, which advises companies on sourcing in Asia.

“The number one reason why we like to be in China is the people. China has extraordinary skills,” Mr Cook told a conference in Guangzhou in late 2017.

That makes it harder for most companies that outsource their manufacturing to respond to the short-term pressures of the US-China trade war. “It’s not realistic that . . . all of a sudden, somewhere like Indonesia is going to be able to make all the nuts and bolts that goes into the world’s products,” Mr Stepanek said.

Nevertheless, Samsung is not alone in looking beyond China. American gadget makers including Google, Fitbit, GoPro and iRobot have moved to diversify their manufacturing beyond China within the past year.

LG Electronics is increasing its smartphone production in Vietnam, rather than China, while Sony said in March that it was closing its Beijing smartphone plant in favour of facilities in Thailand.

Not all electronics companies that have diversified outside China have found it a smooth process.

GoPro was one of the earliest American device makers to make the shift, announcing last December that it would move production of US-bound action cameras from China to Mexico by the latter half of 2019.

But earlier this month, the Silicon Valley-based company was forced to cut its sales and profit forecasts for its new Hero8 cameras, citing production delays.

Such examples make Donald Trump’s objective of getting big electronics groups to move manufacturing back to the US seem even more unlikely.

As Mr Cook put it in 2017: “In the US, you could have a meeting of tooling engineers and I’m not sure we could fill the room. In China, you could fill multiple football fields.”