Donald Trump’s trade war with China will hurt Apple and help its global rivals, the iPhone maker has warned.

In a letter, Apple urged the government not to impose tariffs on iPhones, iPads, Macs, AirPods and Apple TV, as well as parts and accessories for those devices such as monitors and keyboards. Analysts have said tariffs could increase the cost of Apple’s products, many of which are assembled in China and contain Chinese-made components.

The tech firm warned that all of its major products would be hit with additional taxes at the US border as a result of Mr Trump’s plan to impose 25 per cent tariffs on $300bn (£240bn) of Chinese goods.

“We urge the US government not to impose tariffs on these products,” Apple wrote.

The letter published on Wednesday underlines some unintended consequences of the US president’s attacks on Chinese goods and firms such as Huawei. Those attacks have been widely seen as a way of reasserting US economic dominance but also risk hurting American businesses.

The letter also marks a test of the relationship between the president and one of America’s most valuable and important companies.

Back in March, Mr Trump had praised Apple’s boss Tim Cook, who he mistakenly called “Tim Apple”, describing him as “a friend of mine” who has “brought a lot of money back into our country”.

In the letter, Apple pointed out that it was the “single largest US corporate taxpayer and pays billions more each year in local property, sales and employee taxes”.

Apple wrote to Robert Lighthizer, the US trade representative, urging the government to reconsider tariffs (EPA)

US tariffs would “result in a reduction of Apple’s US economic contribution” and also weigh on Apple’s global competitiveness, the company warned.

“The Chinese producers we compete with in global markets do not have a significant presence in the US market, and so would not be impacted by US tariffs,” the letter said.

“Neither would our other major non-US competitors.

Trump has praised Apple boss Tim Cook, describing him as ‘a friend of mine’ who has ‘brought a lot of money back into our country’ (Reuters)

“A US tariff would, therefore, tilt the playing field in favour of our global competitors.”

Japanese financial newspaper the Nikkei reported this week that Apple has​ asked its major suppliers to look at the effects of shifting 15 to 30 per cent of production capacity from China to southeast Asia.

Sources told the newspaper that, even if a resolution is reached between China and the US, any production shifts would be permanent, as Apple considered the risks of relying so heavily on Chinese manufacturing too great.

Neil Campling, head of technology research at investment firm Mirabaud Securities, said other factors beyond trade tensions and tariffs are at play in Apple’s decision.

Moment President Trump calls Tim Cook 'Tim Apple'

“What comes as a surprise in some ways is that it has taken this long,” he said.

“The combination of a lower birth rate, higher labour costs and the risk of overly centralising its production in one country has been a factor in China for some time now, and these adverse factors continue regardless of trade wars and tariff rounds.

“Diversification of production is key.”