Omar Mateen was scaring his co-workers.
In the spring of 2013, the edgy security guard at St. Lucie County Courthouse in Florida was boasting of his family ties to Al Qaeda, the Sunni extremist group, while also bragging that he belonged to Hezbollah, a rival Shiite group.
He hoped to die as a martyr when police raided his apartment, he told his co-workers.
Alarmed, they called the FBI, which launched a 10-month investigation to determine whether Mateen, a U.S. citizen born in New York, really was a terrorist – or might become one.
Between May 2013 and March 2014, the FBI sent an undercover informant who secretly recorded Mateen, conducted surveillance of his movements and scrutinized his communications, FBI officials said Monday. They even interviewed him twice.
At the end, the agents concluded that Mateen was not a threat and had broken no laws. He was full of bluster, they decided, and angry about being teased and in his view, discriminated against, by his colleagues.
His name was removed from the terrorist watch list maintained by the FBI's Terrorist Screening Center, a database that serves as a clearinghouse for federal and state law enforcement agencies to keep track of potential threats.
Several months later, Mateen popped up on the FBI's radar a second time as agents investigated Moner Mohammad Abusalha, a Florida man who had joined Nusra Front, an Al Qaeda affiliate in Syria.
In May 2014, Abusalha blew up a truck packed with explosives, killing more than a dozen people and becoming the first American to carry out a suicide bombing in Syria.
Again, FBI agents interviewed Mateen. He told them he had met Abusalha casually at a local mosque several years earlier. Again, the FBI concluded Mateen wasn't a threat.
Those vivid details and others emerged Monday as FBI officials scrambled to explain how two previous investigations of Mateen failed to prevent him from killing 49 people at a gay nightclub Sunday in Orlando, Fla., in the worst mass shooting in U.S. history.
The bureau's handling of Mateen's case got a strong vote of support from President Obama after he was briefed by James Comey, the FBI director.
"The FBI followed the procedures that they were supposed to and did a proper job," Obama told reporters.
As part of its current investigation, the FBI is seeking to determine whether Mateen scouted out other gay venues or other potential targets, including properties associated with Disney World, according to a senior U.S. law enforcement official briefed on the investigation.
Agents believe he visited those locations in recent months, but cannot say for certain that he was evaluating them as potential targets, the official said.
Former agents said investigators will be digging through Mateen's cellphone and other electronic devices to look for GPS data, and will collect records from businesses and individuals who may have had contact with him.
Comey, along with Homeland Security Secretary Jeh Johnson and Nick Rasmussen, director of the National Counterterrorism Center, will give a classified briefing to House members Tuesday in the first of what is likely to be an extended congressional inquiry into the shooting.
While the FBI was reviewing its records of the two investigations to see if agents missed any clues, senior officials said Monday that they don't know what else they could have done.
"We will continue to look forward in this investigation, and backward," Comey told reporters at FBI headquarters.
"We will leave no stone unturned. And we will work all day and all night to understand the path to that terrible night. We are also going to look hard at our own work to see if there is something we could have done differently," he said.
"So far, the honest answer is that I don't think so. I don't see anything in reviewing our work that our agents could have done differently."
Still, officials found one red flag that may prove important.
During the 2014 investigation of Abusalha, the suicide bomber, FBI agents asked someone else they interviewed who else might become radicalized, a law enforcement official said Monday.
The person singled out Mateen because he had mentioned watching videos featuring Anwar Awlaki, the American-born cleric who joined Al Qaeda and was killed in a 2011 drone strike in Yemen, the official said.
Awlaki's online sermons have inspired a generation of terrorists. They include the Army major who shot and killed 13 people at Ft. Hood, Texas, in 2009, and the couple who shot and killed 14 people in San Bernardino in December.
But the individual added that Mateen had since settled down, gotten married and was holding a steady job. In other words, he told agents that he didn't think Mateen was still a threat.
Mateen was not the first "known wolf," the term analysts use for a person who passes an investigation and then becomes a terrorist. The latest tragedy highlights the challenges authorities face in trying to predict when noxious speech shifts to deadly action.
Authorities had investigated the Ft. Hood killer before his rampage, and had interviewed one of the brothers who planted bombs at the finish line of the Boston Marathon in 2013.
One of the gunmen who tried to assault an exhibit featuring cartoon images of Prophet Mohammed in Garland, Texas, in May 2015 also had been under FBI surveillance.
FBI officials said they have found no evidence indicating Mateen had contact or support from Islamic State or any other terrorist group before Sunday's attack. Indeed, he seemed to have a hodgepodge of motivations for embarking on the massacre.
Thirty minutes into the shooting, Mateen called 911 and told the operator he was swearing allegiance to the leader of Islamic State, Abu Bakr Baghdadi, officials said.
He then expressed solidarity with Dzhokhar and Tamerlan Tsarnaev, the Boston Marathon bombers, and to Abusalha, the Nusra Front suicide bomber.
Neither the Tsarnaev brothers nor Abusalha had any affiliation with Islamic State. To add to the confusion, Nusra Front and Islamic State are fighting each other in Syria.
Similarly, Mateen claimed in 2013 that he had ties to Al Qaeda, a Sunni group, and to Hezbollah, a Shiite group that opposes Al Qaeda.
The FBI investigation found no links to either group and agents concluded Mateen did not understand the difference between Sunni and Shia Islam, the religion's two major denominations, a U.S. law enforcement official said.
Mateen's lack of rigid ideology and his affection for terrorist groups that are at odds with one another suggest he was posturing or seeking an excuse to commit mass murder, experts said.
"The guy seems to be all over the place," Ali Soufan, a former FBI agent who worked on terrorism cases and now runs a security consulting firm in New York, said in a telephone interview.
"This profile is about someone who is violent, mentally unstable, a wife beater – this is all part of a picture that the investigators have to look at," Soufan said.