Britain's decision on whether to allow Huawei a role in building 5G telecom networks will be based on ensuring the national security and ensuring cooperation with the U.S.-led Five Eyes intelligence alliance, Prime Minister Boris Johnson said on Wednesday.

"On Huawei and 5G, I don't want this country to be unnecessarily hostile to investment from overseas," Johnson told reporters.

"On the other hand, we cannot prejudice our vital national security," he added. "Nor can we prejudice our ability to cooperate with other vital Five Eyes security partners — and that will be the key criteria that informs our decision about Huawei."

Huawei said it was confident that the British government would take an "objective" approach.

"We're confident the U.K. government will continue to take an objective, evidence-based approach to cybersecurity," a spokesman for the company said.

"We supply the kind of secure, resilient systems called for by the NATO Declaration and will continue working with them to build innovative new networks," the spokesman said.