Two of the most senior intelligence officials in the US and UK privately shared concerns about “our strange situation” as the FBI launched its 2016 investigation into whether Donald Trump’s campaign was colluding with Russia, the Guardian has learned.

Text messages between Andrew McCabe, the deputy director of the FBI at the time, and Jeremy Fleming, his then counterpart at MI5, now the head of GCHQ, also reveal their mutual surprise at the result of the EU referendum, which some US officials regarded as a “wake-up call”, according to a person familiar with the matter.

While Russia had previously been viewed as a country that would seek to interfere in western elections, the Brexit vote was viewed by some within the FBI as a sign that Russian activities had possibly been successful, the person said.

Their exchanges offer new insights into the start of the FBI’s Russia investigation, and how British intelligence appears to have played a key role in the early stages.

In one exchange in August 2016, Fleming noted that members of the FBI and MI5 had “met on our strange situation”, a veiled reference to discussions about Russian activities, according to the source.

Jeremy Fleming (right) with Prince Charles at GCHQ this month. Photograph: Robert Weideman/EPA

The text messages between the two men were infrequent and cryptic and did not contain specific or sensitive materials, but occurred with some regularity after the referendum in June 2016.

A spokesperson for McCabe declined to comment.

The exchanges underscore a sensitive issue in the US – namely the role foreign intelligence services played in the FBI’s decision to initiate an investigation into the Trump campaign.

On 31 July 2016, the FBI opened a covert counterintelligence investigation codenamed “Crossfire Hurricane” into the then presidential candidate’s possible collusion with Russia.

The investigation was eventually taken over by the special counsel Robert Mueller, who has said there were “multiple, systematic efforts to interfere in our election” by Russia.

Mueller’s 448-page report did not establish a criminal conspiracy between the Trump campaign and Russia, but it did identify incidents in which Trump attempted to obstruct justice in the investigation, and did not clear the president of wrongdoing.

US and UK intelligence agencies frequently share information, but the exchanges between McCabe and Fleming appear to reflect a desire for a direct line of communication given what was seen as a developing problem on both sides of the Atlantic.

In his text message about the August 2016 meeting, Fleming appeared to be making a reference to Peter Strzok, a senior FBI official who travelled to London that month to meet the Australian diplomat Alexander Downer. Downer had agreed to speak with the FBI about a Trump campaign adviser, George Papadopoulos, who had told him that Russia had dirt on Hillary Clinton, the Democratic nominee in the race. The meeting was first reported by the New York Times.

When Boris Johnson, the UK foreign secretary at the time, was asked in November 2017 whether Russia had played any role in British elections, he told MPs in a select committee that he had not seen any evidence of such an occurrence.

When asked in a follow-up if Russia had sought to play a role, Johnson said: “I don’t know about sought to play, but as far as I know they played no role.”

The new revelation comes as authorities in the UK are investigating the funding behind a pro-Brexit campaign, and whether it might have included illegal foreign donations. The National Crime Agency (NCA) is investigating the insurance executive and political donor Arron Banks, who was suspected by the UK’s Electoral Commission of not being the “true source” of £8m in funding to the Leave.EU campaign. The matter was referred to the NCA by the commission after it said it had “reasonable grounds” to suspect a number of criminal offences.

Banks has said there was “no Russian money, no interference” behind the £8m he gave to the unofficial Brexit campaign.

The Guardian reported in 2017 that Britain’s spy agencies played a crucial role in alerting their counterparts in Washington to contacts between members of Trump’s campaign team and Russian intelligence operatives. GCHQ became aware in late 2015 of suspicious “interactions” between figures connected to Trump and known or suspected Russian agents, a source close to UK intelligence said. This intelligence was passed to the US as part of a routine exchange of information, they said.

Strzok and almost every senior FBI official who was involved in the initial Trump investigation has since left the FBI, including McCabe. In many cases, they were dismissed by Trump officials, ostensibly for unrelated reasons. Fleming was elevated to head GCHQ in 2017.

During his period as a senior official at MI5, Fleming served as director for intelligence collection and led MI5’s preparations for the 2012 Olympics. He was appointed deputy director of MI5 in 2013.