The Duke of Cambridge has spent a “humbling” three weeks working with MI5, MI6 and GCHQ, to better understand how the UK’s security and intelligence agencies work.
His time came to an end on Saturday, when he spent the final day of his attachment at GCHQ.
The services are “full of people from everyday backgrounds doing the most extraordinary work to keep us safe,” William said.
The head of counter-terrorism at GCHQ said the duke had worked “exceptionally hard” on his placements.
William first spent a week with the Secret Intelligence Service, also known as MI6, which deals with foreign intelligence and protects the UK from risks abroad.
He learned about the risks to the UK’s national security, military effectiveness and economy, Kensington Palace said.
He then shadowed the Security Service (MI5) for a week, where he saw counter-terrorism teams analysing intelligence and conducting investigations on UK soil.
Finally, he worked at GCHQ, the Government’s listening centre in Cheltenham, Gloucestershire, which monitors communications to look for potential security threats to the UK.
After his placements, the duke said: “Spending time inside our security and intelligence agencies, understanding more about the vital contribution they make to our national security, was a truly humbling experience.
“These agencies are full of people from everyday backgrounds doing the most extraordinary work to keep us safe.
“They work in secret, often not even able to tell their family and friends about the work they do or the stresses they face.
“They are driven by an unrivalled patriotism and dedication to upholding the values of this country.
“We all owe them deep gratitude for the difficult and dangerous work they do.”
A man known only as David, GCHQ head of counter-terrorism operations, said: “Having the Duke of Cambridge spend time with our teams was an incredible opportunity.
“William worked exceptionally hard to embed himself in the team and comfortably held his own amongst some highly skilled analysts and operators.
“His Royal Highness asked some probing questions and demonstrated a real grasp of our mission.
“This was a rare opportunity to expose, in detail, the technical ingenuity and problem solving skills needed on a daily basis to help keep the UK safe.”