A tipoff by Italian authorities that a man who went on to attack London Bridge was in Britain got lost in MI5’s filing system, an inquest has heard.

Youssef Zaghba, one of three attackers who together killed eight people in June 2017, told Italian authorities when travelling through an airport in 2016 that he wanted to be a terrorist.

An MI5 senior official told the inquest into the eight deaths that the error in handling the tipoff may have deprived investigators of a chance to link Zaghba to the attack’s ringleader, Khuram Butt, before the atrocity.

A security service investigation into Butt that began in 2015 over fears he was planning an attack did not uncover his regular meetings and contacts with Zaghba and the third attacker, Rachid Redouane, until it was too late.

The families of the bereaved have accused MI5 of missing “opportunities galore” to stop the attack.

The inquest heard that Italian authorities contacted British intelligence on 15 April 2016 asking if they had any further information on Zaghba. The lost message from the Italians recounted what Zaghba had said a month earlier when trying to fly via Turkey to join Isis.

He was waiting at Bologna airport to board a flight to Istanbul on 15 March 2016 and was asked by a border officer: “What are you going to do in Istanbul?” Zaghba replied: “Be a terrorist.” He quickly corrected himself to say: “Be a tourist.”

The message told the British the Italians believed that Zaghba had travelled to the UK or was believed to have links to the UK.

It was not until 9 June that it was translated and passed to MI6, the foreign intelligence service, and copied to MI5, the domestic intelligence service.

A senior MI5 official, known only as witness L, told the inquest that the message went to the wrong person who did not realise the need to file it. Furthermore, MI5 never responded, and at that time had no knowledge of Zaghba’s existence or presence in the UK, let alone any potential connection to terrorism.

Jonathan Hough QC, the counsel to the inquests, asked: “It is possible the administrative errors that occurred in connection with the Italian authorities request deprived MI5 of the opportunity linking Zaghba to Butt?”

L, giving evidence from behind a green curtain, replied: “Yes it is possible.”

The MI5 witness said if the information about Zaghba had been appreciated then the British would have asked the Italians for more details and possibly put him on a terrorism watchlist, flagging when he entered and exited the UK.

L was also questioned by Gareth Patterson QC, representing six of the victims’ families, about Butt’s use of the Ummah fitness centre in east London. Zaghba and Redouane also used the gym and it has been suggested – although it was disputed by L – that it may have been used to train for the atrocity.

Patterson said: “To put it bluntly, if he’s [Butt] going to a gym every night and you’re not aware of it for many months, there’s a whole range of activity that is happening without your knowledge?”

L said: “Yes, that may be so.”

L offered the “profound sympathies” of MI5 and himself to the victims and said: “Every member of MI5, and particularly every member of my branch, comes to work every day to stop attacks like this. We know that we cannot stop them all, as we failed to stop this one, but it’s our job to try to squeeze the maximum learning out of it.”

Those killed by Butt and his accomplices were Chrissy Archibald, 30, from Canada; Sébastien Bélanger, 36, a chef; Kirsty Boden, 28, a nurse from Australia; Ignacio Echeverría Miralles De Imperial, 39; James McMullan, 32,who was from Brent, north-west London; Alexandre Pigeard, 26, a French restaurant worker; Xavier Thomas, 45, a French national; and Sara Zelenak, 21, an Australian national.

The London Bridge attack was one of four terrorist atrocities in the UK between March and June 2017.

The inquest continues.