Prince William has been secretly shadowing Britain’s top spies for the last three weeks.
The Duke of Cambridge spent his attachment with agents from MI5, MI6 and GCHQ.
ITV News Royal Editor Chris Ship understands the Duke spent time in the field with intelligence officers.
And while Kensington Palace won’t confirm it, Prince William is believed to have watched live operations against terrorist cells at home and against Islamic State in Syria.
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 completing the attachment, 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.”
His attachment comes as the threat level for international terrorism in the UK has been set at 'Severe' or above for the last five years.
Kensington Palace said the Duke was keen to see first-hand the extraordinary work that staff across the Security and Intelligence Agencies do.
The GCHQ's Head of Counter-Terrorism Operations, known as David, said the Duke worked "exceptionally hard to embed himself in the team".
He added: “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.”