The Queen praised MI5 officers for the “tireless work you do to keep our country safe” in her first public visit to the intelligence agency.
The Queen thanked the security personnel on behalf of the nation after meeting a large number of staff at their headquarters, Thames House in central London.
Sir Andrew Parker, MI5’s director general and head, gave the Queen a tour of the agency’s private museum and showed her artefacts relating to double agents.
She was shown documents which were found in her father's possession at the time of his death, including plans which helped deceive the Nazis over the site of the Second World War D-Day landings.
The Queen said in her speech: “I would like to take my visit here today as an opportunity to thank you all for the tireless work you do to keep our country safe.
“I am always struck by the remarkable resolve with which you carry out your vital role.
“There will no doubt continue to be significant threats and challenges ahead.
“But on each of my visits to MI5, I have been impressed by the way that you have adapted to the changing threats to our nation.
“Whether responding to the threats from the Nazis or the Cold War, domestic terrorism or the cyber sphere, you have always demonstrated the utmost commitment to your motto Regnum Defende (defence of the realm).
“Because of the nature of your work, it is without public recognition, so it is on behalf of the country that I say to you all, thank you.”
The meeting comes after Sir Andrew called on tech companies to create methods which would allow the security services to access the secret, encrypted messages of people suspected of plotting terrorist attacks in the UK.
Speaking to ITV, he said while the real world is regulated and policed, he finds it "mystifying" the same does not apply to cyberspace, calling it "a wild west, unregulated [and] inaccessible to authorities."
On Monday, the Government moved to strongly deny claims that MI5 chiefs do not trust Home Secretary Priti Patel and were limiting intelligence sharing with her.