The heads of both MI5 and MI6 are due to step down in the new year at a time of ongoing threats from Islamist extremists, Russia and the rise of China, The Telegraph understands.

Two new top spies, who could be posted in from outside the agencies, will face immediate global problems in these “dangerous times,” a former intelligence official has told the Telegraph.

Sir Alex Younger, the Chief of the Secret Intelligence Service (SIS), better known as MI6, and Sir Andrew Parker, his opposite number at MI5, are both thought to be standing down in 2020.

Their successors are expected to come from within their organisations, although there has been a drive in recent years for personnel to ‘cross pollinate’ between agencies.

Ciaran Martin, 45, who set up the National Cyber Security Centre in 2016, will also leave his post in the summer. Mr Martin will take up a role in the private sector and become a visiting professor at King's College London, he announced on Friday evening.

Philip Ingram, a former military intelligence officer who advises on security matters, said the government will be careful to ensure there is no “gap in the wider understanding” of the threats facing Britain as the pivotal roles are handed over.

“Global events will have a great impact on the selection of their successors,” he told the Telegraph.

“They don’t necessarily need to be spies from with in the agencies but they need credibility. Whoever comes in needs to be knowledgeable on the current issues so you don’t get a gap in the wider understanding. It will be very interesting to see who they put in there [as] they will also need to get on with government.

"I don’t think it’s an issue that they’re both going at the same time. There is nothing to stop them appointing from out of different agencies; there has been a move to bring more outsiders in.”