Robert Hannigan has resigned as director of GCHQ for personal reasons, the British electronic surveillance agency has announced.

Mr Hannigan was director general of defence and intelligence at the Foreign Office before taking over the leadership of GCHQ in 2014.

In a letter to the foreign secretary Boris Johnson, Mr Hannigan wrote: “After a good deal of thought, I have decided that this is the right time to move on and to allow someone else to lead GCHQ through its next phase.

Hannigan will step aside at the spy agency by 2019 /PA Images
Hannigan will step aside at the spy agency by 2019 /PA Images

“I am, like you, a great enthusiast for our history and I think it is right that a new director should be firmly embedded by our centenary in 2019.

“I am very committed to GCHQ’s future and will of course be happy to stay in post until you have been able to appoint a successor.”

But he said the 20 years working in public service roles had “demanded a great deal of my ever patient and understanding family”, adding that “now is the right time for a change in direction”.