Manchester Arena bomber Salman Abedi came to the attention of the security services on at least 18 occasions, the public inquiry into the atrocity heard.
He first came to the attention of MI5 in 2010 and was made a 'subject of interest' in 2014 but the file was dropped four months later.
The security services uncovered links to six other people of interest to them and even a few months before the Arena atrocity more information came to light which had flagged him up for further investigation.
But a meeting to discuss his case was scheduled to take place nine days after the bombing.
And MI5 also admitted a 'missed opportunity' to stop Abedi when he landed at Manchester Airport just a few days before he launched his attack.
The Libyan-heritage Salford University student, who grew up in Fallowfield, killed himself and 22 innocents when he detonated a huge bomb he had built with his brother Hashem, who was in Libya at the time of the attack.
Hashem Abedi was jailed for a minimum of 55 years last month for helping his brother source chemicals and prepare for the attack.
Details of the occasions when Salman Abedi came to the attention of MI5 were outlined as the public inquiry into the disaster resumed on Wednesday.
The first information it received about him was on 30 December 2010. The agency lodged a 'trace request' with the North West Counter Terrorism Unit. Abedi had been linked to an address connected to a 'subject of interest', Cathryn McGahey QC, representing the Home Secretary, told the chairman Sir John Saunders.
Abedi was stop-searched by the police but nothing suspicious was found and there was no indication at that stage he was a risk to national security, the inquiry heard.
In December 2013 another subject of interest was under investigation because he was thought to be planning to travel to Syria and a phone number linked to Abedi had been in contact with them.
Abedi became a subject of interest himself in March 2014 and he remained so until July 2014.
Efforts were made to establish the nature of his relationship with a second subject of interest and whether he might pose a threat to national security, said the QC.
But the investigation was closed when it was deemed he had 'not engaged' with the subjects concerned and there was 'no intelligence indicating that he posed a threat to national security'.
The inquiry has previously heard there are 40,000 closed 'subject of interest' cases.
In 2015, Salman Abedi was identified as the owner of a telephone number which had been in contact with another subject of interest who had been linked to Al-Qaeda and who was under investigation for helping people travel to Syria.
MI5 also held intelligence that Salman Abedi had met with that subject of interest 'on a number of occasions'.
But none of the information gathered suggested that contact showed Abedi migjht pose a threat to national security, said the QC.
MI5 did not believe that contact was involved in attack planning with Abedi, the inquiry was told.
Also in 2015, MI5 received information that Salman Abedi was in contact with a third subject of interest who had a history with an extremist group in Libya.
That contact may have had 'some radicalising influence' on Abedi but there was no information to suggest he was involved in attack planning, the inquiry was told
In October 2015 Salman Abedi was reopened and then closed as a SOI in the course of a single day due to a 'misunderstanding'.
But on three subsequent occasions Salman Abedi was identified as a 'second level' contact of another 'subject of interest' who was said to be providing financial support to ISIL in Syria and had travelled to Syria.
Again it was decided that he was not engaged in 'attack planning' and did not pose a threat to national security.
MI5 was also aware that Salman Abedi had visited a known extremist prisoner 'on more than one occasion', the inquiry was told.
More information was sought by the security services but 'this did not result in any intelligence which was assessed to justify opening Salman Abedi as a SOI'.
The prisoner concerned was not named during the inquiry but is understood to be Abdalraouf Abdallah.
"MI5 received information that Salman Abedi had travelled to Libya on a number of occasions, from 2011 onwards. It was known he had family in Libya and so there was nothing inherently suspicious about these trips.
"Information was also received in relation to his travel to Saudi Arabia during the Hajj. On two occasions information was received that gave MI5 cause to consider that Salman Abedi may be travelling to Syria, but on both occasions checks were conducted and showed that he had not," said Ms McGahey.
But MI5 decided that neither case indicated that he posed a threat to national security, it was said.
From mid-2015 onwards MI5 received information on Salman Abedi on several occasions, the inquiry was told, but the information about his worldview was 'conflicting' and not taken further.
The inquiry heard that on two separate occasions 'in the months prior to the attack' intelligence was received by MI5 about Salman Abedi.
The QC said: "The intelligence was assessed at the time to relate to possibly innocent activity or to non-terrorist criminality on his part. In retrospect this intelligence was highly relevant to the planned attack, but the significance of it was not fully appreciated at the time."
But the QC said the decision not to 're-open' Abedi as a person of interest in the months before the attack was 'finely balanced' yet 'understandable in all the circumstances'.
She added: "However, MI5 also considers that there were certain aspects of the information that came to its attention in the months before the attack which could have been handled differently, and if they had been, then that different handling might have helped the investigative team in their decision-making.
"However, the extent to which different handling of the information might have affected the investigative team’s subsequent decision making is highly uncertain. It is also the case that the opportunities for detecting Salman Abedi’s attack planning would have been very limited indeed."
The inquiry was told that MI5 assessed that the investigative actions taken in relation to Salman Abedi when he was opened as subject of interest in March 2014, and the decision to close the file in July 2014, were 'reasonable on the basis of the information available at the time'.
When that file was closed, Abedi 'was deemed low risk and was not referred to Prevent, the strategy aimed at deterring people from extremism.
Get the latest updates from across Greater Manchester direct to your inbox with the free MEN newsletter
You can sign up very simply by following the instructions here
MI5 believed the actions it took were 'reasonable and understandable when judged in the light of the further information available at the time'.
On 3 March 2017 Salman Abedi hit a 'priority indicator' which, although not indicating any attack, meant he met the threshold for further investigation.
Further checks were established which concluded Abedi was 'probably in Libya'.
On May 8 it was decided he should be referred for a 'low-level investigation' to establish whether Abedi had 're-engaged in Islamist extremist activity'.
A meeting to consider that was scheduled for May 31, nine days after the bombing.
The fact the system had identified him as someone who deserved further investigation showed it was working, said the QC.
But the inquiry heard that the information which prompted the re-think had been obtained 'many months before' the March 2017 'priority indicator'.
The QC said this was an area 'for potential improvement' and since then changes had since been adopted by MI5 to speed things up.
The inquiry heard there was an opportunity to place Salman Abedi on 'ports action' following his travel to Libya on 15 April 2017.
He was at the time a closed 'subject of interest' case but MI5 now believe this was a 'missed opportunity', the inquiry is told.
Had it been taken it would have triggered an alert when he returned to the UK to carry out the attack and would have enabled him to be stopped, searched and questioned at the airport, the inquiry was told.
"Even if Salman Abedi had been placed under travel restrictions, there may still not have been sufficient time to identify or act on his attack planning. Nonetheless, MI5’s review concluded that Salman Abedi should have been put on ports action following his travel to Libya in 2017," said the QC.
She added: "MI5 is acutely conscious that the question of whether action could have been taken which would (or might) have made a difference to the tragic outcome in this case is a matter of central relevance to the inquiry and of profound concern to the bereaved families.
"It is important that this issue is rigorously addressed not only to determine whether this attack could have been prevented but also to learn lessons which may assist in preventing future attacks."
Or to like his Facebook page and keep up to date with the latest breaking news and stories from court, click here.
Here's the link to the M.E.N's main Facebook page where we share our latest stories.