Video report by Amy Welch
Manchester Arena suicide bomber Salman Abedi was identified associating with six separate MI5 "subjects of interest", visited a terrorist twice in jails and regularly travelled to war-torn Libya.
The Manchester Arena Inquiry was told how intelligence on Abedi came in to MI5 for six years and right up to the months before he murdered 22 people and injured hundreds more in the foyer of Manchester Arena at the end of an Ariana Grande concert on May 22, 2017.
On one occasion, Abedi had himself been made a "subject of interest", but his file was closed five months later in July 2014.
The fullest details yet given about the security services' knowledge of Abedi before he carried out the attack was told to the inquiry by Cathryn McGahey QC, representing the Home Office.
The inquiry, scheduled to last into next spring is looking at events before, during and after the attack - including the radicalisation of Abedi and what the security services knew about him.
Ms McGahey said some of the exact detail could not be made public and will be heard only by inquiry chairman, retired High Court judge Sir John Saunders, his legal team and government lawyers during closed hearings of the inquiry.
But the QC said: "There is no question of secrecy being used to conceal failure."
Twice in the months prior to the attack, intelligence was received by MI5 about Abedi, but was assessed at the time to relate to possibly non-nefarious or non-terrorist criminality.
In retrospect, this intelligence was highly relevant to the planned attack, but the significance of it was not fully appreciated at the times, the inquiry heard.
Abedi's name also hit a "priority indicator" during a separate "data-washing exercise" as falling within a small number of former subjects of interest who merited further consideration.
A meeting to consider the results was scheduled for May 31, 2017, nine days after the bombing.
But even if MI5 had taken different decisions in the months before the attack it may not have stopped the bombing, Ms McGahey said.
It would have taken time to build up intelligence and allocate resources against a large number of other ongoing investigations, she said.
Abedi had first come to MI5's attention on December 30, 2010, through his links to an address relevant to a subject of interest (SOI).
Three years later, an investigation into an SOI "A" suspected of involvement in planning to travel to Syria discovered telephone contact with Abedi.
In March 2014, Abedi was opened as an SOI but closed that July and investigation into him ended "based on his lack of engagement with individuals of interest" to MI5.
Further intelligence was received that Abedi met with two other SOIs associated with people in Syria and extremists in Libya respectively.
On three later occasions, Abedi was identified as a "second-level" contact of three other SOIs, in April 2016 and April and January 2017.
The SOIs involved were suspected of providing support or recruitment for Isil in Syria or Libya.
And in both February 2015 and January 2017, he visited in two separate UK jails, Abdalraouf Abdallah, a convicted terrorist.
The hearing was adjourned until Thursday morning.