LONDON (Reuters) - Britain's decision to allow Huawei to play a role in building 5G networks will depend on national security and cooperation with the US-led Five Eyes Intelligence Alliance, Prime Minister Boris Johnson said on Wednesday.

"Regarding Huawei and the fifth generation, I don't want this country to be unnecessarily hostile to investors from abroad," Johnson told reporters.

"But on the other hand we cannot compromise our vital national security, nor can we compromise our ability to cooperate with vital security partners like the five eyes, and that will be the main criterion that guides our decision on Huawei."

The statement comes after a meeting with US President Donald Trump on the sidelines of the special summit of the North Atlantic Treaty Organization (NATO) in London.

Britain remains reluctant to make a clear decision to outsource the development of its 5G network to Huawei, which was listed by the United States in June.