WASHINGTON — The F.B.I. director said on Monday that the gunman in the mass killing in Orlando was on a terrorist watchlist from 2013 to 2014, but that months of intense investigation into his foreign travels, his inflammatory language with co-workers and his possible motivations did not produce enough evidence to arrest him.

The director, James B. Comey Jr., defended his agency’s handling of its past inquiries into the gunman, Omar Mateen, telling reporters that there had been no indication that F.B.I. agents in Florida missed any chances to apprehend or prosecute Mr. Mateen before the deadly rampage in which he proclaimed his allegiance to the Islamic State.

The attack highlighted the difficulty the American government faces in addressing the threat from the terrorist group. Unlike Al Qaeda, which favored highly organized and planned operations, the Islamic State has encouraged anyone to take up arms in its name. Often, that means the F.B.I. is looking to identify people who have committed no crime.

Once the F.B.I. closes an investigation, agents are required to remove the targets from terrorism watchlists. That rule is intended to prevent the United States from keeping secretive, open-ended watchlists based on suspicions that are ultimately unfounded.