Apple boss Tim Cook pushed back against Donald Trump’s attacks, defending the tech giant’s record of investing in its home country and announcing a $1bn fund for advanced manufacturing in the US.

As a presidential candidate, Donald Trump used Apple as an example of what he perceives to be wrong with corporate America, attacking the company for making iPhones and iPads in China instead of the US. The President also urged his millions of Twitter followers to boycott Apple products unless the company agreed to soften its pro-encryption stance to allow authorities to read messages.

In an interview with CNBC from Apple’s California headquarters on Wednesday, Mr Cook made his case against Mr Trump’s allegations.

“We’ve now created 2 million jobs in America. This doesn’t include the multiplier effect which would make it a tonne more,” he said.

The chief executive also pointed to the billions of dollars worth of components and raw materials that Apple buys from US manufacturers, including adhesives from chemical company 3M and glass for iPhone screens from New York-based Corning.

Through its App Store, the company also supports a developer community of one-and-a-half million people, Mr Cook said. “These are folks from really small businesses... and they’re writing apps that can change the world."

A new $1bn fund would seek to encourage advanced manufacturing in the US, he said, while pointing out that Apple already employs 25,000 US workers in research and development.

The pitch from Mr Cook comes after Apple reported a surprise slowdown in iPhone sales, and at a time when the company is seeking what Mr Cook described as “comprehensive tax reform”. Apple currently has more than $250bn held overseas - the biggest foreign cash pile of any US company. It would face a huge tax bill if it were to bring that money back to the US.

“If you sell globally you earn money globally, if you earn money globally, you can’t bring it back unless you pay 35 per cent plus your state tax”, the Apple chief executive said. “That’s kind of bizarre”.

Critics have accused Apple of using low-tax jurisdictions such as Ireland to set up its global operations in a way that is not reflective of the true nature of its business. The company’s latest annual report show it paid an effective tax rate of just 5.2 per cent on its non-US earnings.

Mr Trump’s administration has proposed slashing the US corporate tax rate to 15 per cent, and introducing a one-off repatriation tax of ten per cent for money already held offshore. However, the proposals require approval from Congress, something which is far from assured at present.

Mr Cook also reiterated his stance against the President’s “Muslim ban” which saw people from seven mostly-Muslim countries temporarily denied entry to the US earlier this year.

Apple, along with hundreds of other companies, many from Silicon Valley’s tech industry which relies heavily on skilled migrants from around the world, filed a legal brief in protest at Mr Trump’s executive order, which was later amended after judges ruled against the ban.

In pictures: Apple iPhone 7 launch event Show all 13 1 /13 In pictures: Apple iPhone 7 launch event In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Apple Inc CEO Tim Cook discusses the new phone In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event It looks similar to the 6 and 6s. Apple say it is the "most singular, most evolved representation of this design". In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event The iPhone has become a "cultural phenomenon". Over one billion handsets have been sold. In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event There's a new refined design for the iPhone 7. A high gloss finish and a seamless surface between the glass and the aluminium back. In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event The new enclosure is water and dust resistant. In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event It does seem to look a lot like the iPhone 6s. The big changes are slightly rounded edges, the loss of antenna lines, and what looks like a very glossy black colour. In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Apple Inc CEO Tim Cook discusses the App Store. Reuters In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Apple Inc CEO Tim Cook discusses Apple in education. Reuters In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Apple Inc CEO Tim Cook greets Nintendo Creative Fellow Shigeru Miyamoto. Reuters In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Nintendo Creative Fellow Shigeru Miyamoto announces a Mario Bros game for the iPhone, as a translator stands nearby. Reuters In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Apple CEO Tim Cook speaks during the Apple launch event at the Bill Graham Civic Auditorium in San Francisco, California, USA. EPA In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event The new Watch has a new display that's twice as bright as the existing one. It's brighter than any other Apple screen ever. Reuters In pictures: Apple iPhone 7 launch event Apple iPhone 7 launch event Apple Watch "series 2", as it's called, is waterproof up to 50 metres. Reuters

Apple will continue to make its voice heard, Mr Cook said: “If you don’t show up, I think that’s the worst scenario because then you’re quiet and that doesn’t do your cause any good", he said.

But in an apparent attempt to build bridges with the White House, the chief executive said: “With any administration, there are things you will agree upon and things that you will not and you don’t want to let the things you don’t [agree on] mean that you don’t have any interface.”