US tech giants Microsoft and Hewlett Packard Enterprise (HPE) have said the UK should remain in the European Union (EU) in order to attract future investments.

The vocal support for the remain camp comes just weeks before the UK heads to the polls. The referendum is due to take place on 23 June.

Microsoft UK CEO Michel Van der Bel has written a letter to staff taking a position on the matter.

He said: "We appreciate and respect that there are a range of reasons that motivate people on both sides of the debate, but as a business that is very committed to this country, our view is that the UK should remain in the EU.

"Historically, the U.K. being part of the EU has been one of several important criteria that make it one of the most attractive places in Europe for the range of investments we have made."

Microsoft has been operating in the UK since 1982. The company employs over 5,000 people and works with 25,000 businesses.

However, the company indicated that it will not stop operations in the UK if the country votes in favour of Brexit.

Van der Bel said "Whatever the outcome of the referendum, we respect the decisions made by UK voters. Our commitment to our staff and business here remains firm, but we also believe the UK remaining in the EU supports important criteria for continued and future investment by Microsoft and others," he said.

At the same time, Hewlett Packard Enterprise UK managing director Andy Isherwood sent a note to the staff, saying that the UK should remain in the EU.

Isherwood said the UK’s continued membership of the EU brings a range of positive benefits to its business, customers, employees and to the UK economy as a whole.

"We believe that if the U.K. were to leave the EU it would be likely to have a detrimental impact on the long-term prospects for employment, research, investment and innovation in this country," Isherwood wrote to staff.

Apart from Microsoft and HPE, IBM and Siemens have already opposed Brexit.

Last month, IBM UK boss David Stokes said in an internal blog to staff, "As a large, globally integrated business with a strong presence across the EU, IBM sees significant benefits from EU economic integration.

"The UK tech industry employs 1.56 million people and contributes £1 in every £10 to the local economy. As a member of the EU, the completion of the Digital Single Market will further accelerate this success for UK tech."

A recent poll by techUK found that the majority of UK tech companies (70%) support the country remaining a member of the EU.

techUK polled 277 tech business leaders, three-quarters of which were SMEs, and identified a clear majority for the In camp.

Only 15% of tech firms came out in favour of a Brexit, with a further 15% sitting on the EU/UK fence and saying that they were not decided.