A more fragmented Europe would be "bad for Nato", the military alliance's secretary general has said.
While stressing that he did not want to comment on the upcoming referendum on the UK's EU membership, Jens Stoltenberg said that a "strong UK in Europe" was good for security and good for Nato.
He was speaking after talks at 10 Downing Street with Prime Minister David Cameron, who stressed the importance of both the EU and Nato in maintaining stability in Europe and fighting terrorism.
Mr Stoltenberg said: "I will not comment on the ongoing debate in the UK on whether the UK is going to stay or not in the European Union. That is up to the people of Britain to decide.
"But what I can do is to say what matters for Nato. A strong UK in Europe is good for our security, it is good for Nato and I welcome that.
"A more fragmented Europe is bad for our security and it is bad for Nato."
Mr Stoltenberg said the EU and Nato were "complementary" in crises such as Russia's aggression towards Ukraine, when the EU implemented economic sanctions while Nato delivered military deterrence.
"All of these measures are of great importance delivered by Nato and the EU," he said.
"We also see the importance of the UK being so supportive both inside Nato and inside the European Union promoting increased co-operation between Nato and the EU."
Welcoming Mr Stoltenberg to Number 10, Mr Cameron said the EU plays an "important" role in maintaining Britain's security and strength.
The PM said the talks, ahead of a Nato summit in Warsaw in July, were focused on the fight against terror, the migrant crisis in the Aegean, the need to "stand up strongly and firmly against Russian aggression" in Ukraine, and the situations in Libya and Afghanistan.
While he did not mention the UK's upcoming referendum on EU membership, Mr Cameron made a point of stressing the 28-nation bloc's role in preserving stability.
Mr Cameron said: "I'm sure we will be talking about the co-operation between the EU and Nato, because these are both important for our security and for our stability, for Britain's strength and power in the world and indeed for fighting the terrorism we face from Daesh."
Mr Cameron said he would discuss with the former Norwegian PM "all the steps we take as Nato powers and as EU powers to make sure we keep terrorists outside of our continent and out of the UK".
And he said he wanted to talk about how to ensure that ongoing Nato operations against people-smugglers in the Aegean Sea "work and work well".
On Russia, Mr Cameron said Nato must ensure "we stand up strongly and firmly against Russian aggression, including in Ukraine, and that we make sure that there is strong deterrence and a strong eastern presence for Nato".
Mr Stoltenberg said Britain was "showing the way" for other European states by meeting the target of spending 2% of GDP on defence agreed at a previous summit of the transatlantic military alliance in Newport.
He said Nato could "count on the UK and count on David" in the fight against terrorism, dealing with the migration crisis and the expansion of co-operation between the EU and Nato.
"I use the UK as an example for all the European allies, that it is possible to invest in defence and to meet the pledge we made together after the summit in Wales to invest 2% of GDP in defence," said Mr Stoltenberg.