As law enforcement officials in Orlando continue their investigation of the Pulse nightclub shooting, former State Department counterterrorism analyst Tricia Bacon describes the steps they take to ensure all leads are carefully explored. (Jorge Ribas,McKenna Ewen/The Washington Post)

The FBI investigated the Orlando shooter for 10 months beginning in 2013, putting him under surveillance, recording his calls and using confidential informants to gauge whether he had been radicalized after the suspect talked at work about his connections with al-Qaeda and dying as a martyr.

As part of the investigation, Omar Mateen, who was killed in a shootout with police on Sunday morning, was placed on a terrorism watch list and interviewed twice before the probe was closed in March 2014 because agents concluded he was not a threat, FBI Director James B. Comey said Monday in an interview with reporters at bureau headquarters.

Several months later, in July 2014, Mateen surfaced in another investigation into the first American to die as a suicide bomber in Syria, a fellow Floridian. And, again, investigators moved on.

It was the third time — following the Boston Marathon bombing in 2013 and a planned attack last year on a contest to draw the prophet Muhammad — that someone who had been scrutinized by the FBI later carried out a terrorist attack.

Comey said the bureau was reexamining its contact with Mateen as new details emerged from law enforcement officials about the deadliest shooting rampage in U.S. history — a massacre that left 49 people dead and dozens of others wounded at a gay nightclub in Orlando.

“We are also going to look hard at our own work to see whether there is something we should have done differently,” Comey said. “So far, the honest answer is: I don’t think so.”

Comey said that during the three-hour standoff the gunman had with Orlando police officers, there were three different ­911-related calls with him. The gunman called 911 at about 2:30 a.m., about half an hour after opening fire, and then hung up the phone. Mateen then called a second time and spoke briefly to a dispatcher before hanging up again, and then the dispatcher called him back and they spoke briefly.

“During the calls, he said he was doing this for the leader of ISIL, who he named and pledged loyalty to,” said Comey, using an acronym for the group known as the Islamic State.

However, Comey said there were no signs that Mateen was directly tied to any kind of network, and he added that it remained unclear exactly which extremist group he supported. In addition to pledging allegiance to the leader of the Islamic State, Comey noted, Mateen referred to a link to its bitter rival, al-Qaeda — an American’s suicide bombing in Syria. He also expressed solidarity with the Boston Marathon bombers.

President Obama said Monday that the gunman appeared to be motivated by extremist propaganda online, while saying that investigators delving into the attacker’s background have not found any communication linking him with radical groups.

A board member at the Islamic Center of Fort Pierce in Florida talks about Orlando shooter Omar Mateen’s attendance and demeanor. (Lee Powell/The Washington Post)

“We see no clear evidence that he was directed externally,” Obama said during remarks in the Oval Office. “It does appear that at the last minute, he announced allegiance to ISIL. But there is no evidence so far that he was in fact directed by ISIL, and at this stage there’s no direct evidence that he was part of a larger plot.”

Obama said that the shooting appeared so far to be a case of “homegrown extremism.”

As terrorism again surged to the forefront of the country’s political debate, the presumptive nominees for the two major parties, Donald Trump and Hillary Clinton, shifted plans for events Monday to focus their remarks on national security.

Clinton, speaking in Cleveland, warned that the threat posed by the Islamic State is “metastasizing” and vowed to make “targeting lone wolves a top priority” if elected.

She also said that someone who has been watched by the FBI “shouldn’t be able to just go buy a gun with no questions asked.”

“It’s essential that we stop terrorists from getting the tools they need to carry out attacks,” she said. “I believe weapons of war have no place on our streets.”

Mateen carried a semiautomatic assault rifle and a handgun; a third gun was later found in his car, officials said.

Trump made television appearances Monday to reject calls for more gun control and repeatedly accuse Obama of being somehow sympathetic with radicalized Muslims.

“We’re led by a man that either is not tough, not smart, or he’s got something else in mind,” Trump said.

In a speech in New Hampshire, he called for a ban on immigrants from Middle Eastern countries Monday but notably did not make explicit reference to a religious test on Muslims, which he has mentioned in the past. He said that strengthening the effectiveness of immigration screenings is a key component to preventing domestic terrorism.

Law enforcement officials in Florida, meanwhile, offered a new accounting of the shootout. Orlando Police Chief John Mina said that police first encountered Mateen shortly after the initial gunfire at about 2 a.m., when an off-duty officer working at the club exchanged shots with Mateen.

Additional officers called to the scene soon joined in another gun battle, at which point Mateen retreated farther into the building and, eventually, into a bathroom. The police then held back because there were no more gunshots, Mina said, and they tried to negotiate with Mateen to avoid any more bloodshed.

Mateen had been in a bathroom with four or five people, while an additional 15 or 20 were in another bathroom, Mina said. During these negotiations, Mateen was “cool and calm” and did not make many demands, Mina said.

After about three hours, police said they decided to storm the building after the shooter mentioned bomb belts or explosives. Mina said the police used explosives and then an armored Bearcat to break a hole in the club’s wall. Hostages poured out, and Mateen — armed with a pair of guns — came out as well.

During the gun battle, Mateen was killed and one Orlando police officer was injured when a bullet struck his Kevlar helmet.

However, much remains unclear, including whether any hostages were injured or killed by crossfire.

In a news conference Monday, Mina said storming the building “was the right decision to make” because police thought other lives might be in danger.

Authorities say they are continuing to explore whether other people may be connected to the case. The investigation into Mateen has expanded to look at other people and stretches from Florida to Kabul. Mateen’s family is originally from Afghanistan.

Comey said Mateen, who worked as a contract security guard at a local courthouse, claimed in 2013 to co-workers that he had family connections to ­al-Qaeda and was a member of Hezbollah, two opposing terrorist groups that have clashed repeatedly in Syria.

The FBI director called the comments “inflammatory and contradictory.”

Comey said Mateen also told colleagues that he had mutual acquaintances with the Tsarnaev brothers, who were responsible for the Boston bombing. He spoke of a martyr’s death. Co-workers brought his claims to the attention of the local sheriff’s department, which passed them along to the FBI.

The FBI opened what is known as a preliminary investigation — one of hundreds that the bureau handles at any one time and that typically last six months. Comey said the investigation was extended once with the approval of an FBI supervisor at the Joint Terrorism Task Force in Miami.

When interviewed by the FBI, Mateen claimed he made the statements in anger because his co-workers were teasing him about being a Muslim and he felt discriminated against.

“The evidence developed during the investigation was consistent with his explanation that he had said these things to try to freak out his co-workers,” Comey said.

The investigation was closed.

“As I would hope the American people would want, we don’t keep people under investigation indefinitely,” Comey said. “If . . . we don’t see predication for continuing it, then we close it.”

During the period of the investigation, Mateen was placed in a terrorism database, but Comey declined to say whether the bureau also put him on the no-fly list.

The FBI also learned that he had traveled to Saudi Arabia in March 2011 to make a pilgrimage and again in March 2012. Comey said the Saudis assisted the FBI investigation but didn’t turn up anything.

Mateen’s name next surfaced as part of the investigation into Moner Mohammad Abusalha, believed to be the first American to launch a suicide bombing in Syria. Abusalha prayed at the same Fort Pierce, Fla., mosque that Mateen attended, friends and authorities said.

A witness told the FBI he had become concerned about Mateen, who had been watching videos of a radical cleric, Anwar ­al-Awlaki, a top leader and propagandist in al-Qaeda’s branch in Yemen. Awlaki’s rhetoric has been implicated in numerous terrorist attacks, including the 2009 Fort Hood shooting in which 13 people were killed by Army Maj. Nidal Hasan.

But the witness stopped worrying when Mateen started a relationship, had a child and found steady employment as a security guard.

The FBI questioned Mateen again but found no reason to reopen an investigation.

Comey said the FBI had found nothing in Mateen’s past that would have legally blocked him from purchasing a gun.

Mateen purchased two weapons from the St. Lucie Shooting Center, shop owner Ed Henson said at a news conference Monday.

“An evil person came in here and legally purchased two firearms from us,” Henson said, adding that Mateen had multiple security licenses and passed a full background check before he was allowed to buy the guns.

Henson said that if Mateen hadn’t bought the guns at his shop, he would have been able to buy them somewhere else.

“We happened to be the gun store he picked. It’s horrible,” said Henson, who spent two decades with the New York Police Department before retiring in 2002. “I’m sorry he picked my place. I wish he’d picked nowhere.”

Zapotosky reported from Orlando. Greg Miller, Joby Warrick, Sarah Larimer, Julie Tate, Emma Brown, Brian Murphy, Jenna Johnson, Missy Ryan, and Jerry Markon in Washington; Katie Zezima, Hayley Tsukayama and Amanda Elder in Orlando; Abby Phillip in Cleveland; Tim Craig in Kabul; and Thomas Gibbons-Neff in Brussels contributed to this report.