The name's Windsor, William Windsor. As one of the most recognizable public figures in the world, Britain's Prince William would not make as effective a 007 as legendary fictional spy James Bond.

But that did not stop the heir to the British throne from spending the last three weeks working with the security services, including Bond's own foreign intelligence unit MI6. The Duke of Cambridge ended the top-secret attachment — which also included a week with domestic intelligence service MI5 and cybersecurity agency GCHQ — on Saturday, according to Kensington Palace.

"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," William said in a statement. "These agencies are full of people from everyday backgrounds doing the most extraordinary work to keep us safe."

Get Breaking News Delivered to Your Inbox

The prince, who has a military background, began shadowing the security agencies at the Secret Intelligence Service (SIS) — better known as MI6 — whose spies work around the world gathering information and furthering British interests. William, 36, "got to see first-hand how SIS helps the UK identify and exploit opportunities as well as navigate risks to its national security, military effectiveness and economy," Kensington Palace said.

Britain's Prince William participates in a three-week attachment with the country's security and intelligence agencies in this undated photo released by Kensington Palace on April 7, 2019. Kensington Palace/Handout via Reuters

The father-of-three then switched over to the Security Service — MI5 — to observe how counter-terrorism teams conduct investigations, including surveillance. The duke finished his foray into spycraft at the communications monitoring agency GCHQ in Cheltenham, in western England.

There he spent time "with those using cutting-edge technology, technical ingenuity and wide-ranging partnerships to identify, analyze and disrupt threats," the palace added. GCHQ's head of counter-terrorism operations, whose name was given only as David, said the prince had worked "exceptionally hard to embed himself in the team."

He added William had "comfortably held his own amongst some highly skilled analysts and operators." The prince is no stranger to the world of security.

After graduating in 2005 from university in St. Andrews in Scotland, he spent seven and a half years in the military, before completing active service as a search and rescue helicopter pilot.