MI5 spies are being brought into the Brexit process amid fears that UK government leaks and covert surveillance by EU states could damage UK interests as crucial trade and security talks begin this week.

Spies are to warn politicians and civil servants involved in EU negotiations that foreign intelligence officers could be “listening in” to private communications as the the European Union attempts to “gain an advantage”, according to security sources.

One former diplomat said ministers and civil servants who are unofficially leaking “should be worried” after MI5 created a new post, a Head of Protective Security Advice to Government, aimed at “closing loopholes” in Whitehall departments.

The appointment of a new spy comes as the SNP’s Foreign Affairs spokesman Stephen Gethins revealed he was stripped of all electronic devices before two “officials” stood over him while he read Brexit impact papers in a secure room at a government building in Whitehall.

READ MORE: 'I've seen secret Brexit impact assessment papers and they're an embarrassment to the UK'

There is believed to be increasing paranoia at the heart of government after a series of leaks during the first phase of Brexit negotiations put Prime Minister Theresa May on the backfoot and threatened to destabilise the entire process.

The second phase of talks on the future relationship between the UK and EU begins this week with May still smarting from her defeat in the UK parliament last week which guarantees MPs a “meaningful vote” on the final Brexit deal.

The next phase of talks will see ministers and civil servants discuss a framework for security and trade. Previously friendly relationships between UK ministers and their counterparts in EU states are likely to come under increasing strain ahead of Brexit. One former British diplomat said UK spies will issue a warning to ministers about “hostile” intelligence agencies ahead of negotiations.

Charles Bird, a Teaching Fellow at the Centre for the Study of Terrorism and Political Violence (CSTPV) at the University of St Andrews, and who was previously a member of HM Diplomatic Service specialising in conflict, post-conflict, terrorism and counter-terrorism issues, told the Sunday Herald: “MI5 is creating a new role that is pulling together various strands so that somebody has an overview of what’s going on across government and trying to get a consistent policy so that all ministers behave in the same way. And not just ministers, but anybody overseas representing the UK so that they know there is an expected level of personal security, cyber security, and information security.

“When ministers travel abroad they don’t always stay in embassies. They’ll stay in hotels, government guest houses. Certainly, when I was posted in embassies we were aware that host governments would be very interested to know what our strategies were for ministerial meetings. They would want to know what we were talking about before we went into meetings with heads of government or other ministers."

READ MORE: How Brexit made European friends hostile neighbours

Referring to the new 'Brexit spy' post created by MI5, he said the Head of Protective Security Advice to Government would give "briefings to ministers. Part of that will be saying: “Minister, you may be having a great time but, you know, don’t phone your wife or your mum and tell them what’s going on and what you’re doing because somebody will be listening in. Don’t send an email saying you had a great talk with a head of state, or they were unreceptive, or whatever. Just don’t do it. Use the classified systems to communicate.

“The other thing is paper trails. So, making sure briefing notes are not thrown in hotel waste paper bins. I’ve known classified bits of paper get thrown away in public spaces which have the potential for causing deep embarrassment.

“That advice would of course absolutely extend to ministers involved in Brexit negotiations. There have been enough scandals about bugging or listening in to heads of state. Everybody wants an advantage over everybody else.”

Bird said the new 'Brexit spy' job was a “chunky role” which will be about “closing loopholes” to make sure government ministers aren’t being “insecure” when abroad, and government departments “aren’t being lax”.

He added: “If anyone has been leaking unofficially they should be worried. There’s a difference between having a chat with a friendly journalist and letting a bit of gossip slip, and sending something by insecure means that hostile intelligence agencies could gain access to. One is being slightly indiscreet, and the other is being desperately insecure. It looks like this new MI5 job is dealing with the overall security aspect of it.”

Phillips O’Brien, a Professor of Strategic Studies at the University of St Andrews’ School of International Relations, said: “The fact that they are going for a completely new post and department now means that either they feel that the British position has suffered because of leaks and espionage in the recent past, or they have been negligent to begin with.

“The government has well-funded intelligence agencies. They have done very well out of the latest funding rounds, much better than the armed forces. So, it’s significant that they feel that they are not enough right now.”

Another security source, who asked not to be named, said that the job of MI5 advising government over Brexit involved getting across “the ABC of good and bad security practice across, to open the subject up in a credible way for post-holders who may not have thought much about such things, and to tell them who might have an interest in their telephone conversations or the contents of their laptops”.

The MI5 job of Head of Protective Security Advice to Government involves briefing ministers on security threats and managing a team of specialist advisers. The key job requirement is securing “sensitive information relating to Brexit negotiations and trade deals”.

READ MORE: 'I've seen secret Brexit impact assessment papers and they're an embarrassment to the UK'

There are concerns that the government may have problems keeping staff in such a role. Phillips O’Brien warned: “There is huge demand in both the private and public sector for security professionals in cyber, communications etc. Salaries are already very high, and people are head-hunted all the time. To get someone good, they will have to pay.”

SNP MEP Alyn Smith said: “For the first time the UK is having to contemplate conducting trade deals alone, rather than through the EU, so a whole range of officials need to be employed to replace functions that are already working well, and I don’t remember any campaign slogans on the side of a bus telling me to vote leave to shell out unknown sums to recruit vast amounts of new civil servants and spooks to keep their laptops safe.”

The SNP’s foreign affairs spokesman Stephen Gethins MP added:“Little did we know that ‘taking back control’ meant drafting in MI5 to prevent the public from finding out that the UK government, eighteen months on from the EU referendum, still has no plan for exiting the EU.

“It appears as though the government is spending more time trying to stop the leaks of their Brexit strategy, that they've actually forgotten to come up one in the first place"

The Sunday Herald contacted the Home Office, which answers questions for MI5, but a request for an interview was declined and a spokesman refused to issue a prepared statement “for security reasons”. The Home Office spokesman also said the Department for Exiting the EU would not comment.