The FBI investigated Omar Mateen twice before he killed 49 people at the Pulse nightclub in Orlando. (Jason Aldag/The Washington Post)

The mass shooting at a gay nightclub in Orlando was the third time in recent years that someone who had been under FBI scrutiny carried out a terrorist attack, raising questions about whether the legendary crime-fighting agency is equipped to stop escalating threats in the digital age, experts and former federal officials said Tuesday.

The deadly assault at the Pulse nightclub followed the Boston Marathon bombing in 2013 and last year’s shooting at a Texas exhibition of cartoons depicting the prophet Muhammad. While the circumstances of each case varied widely, they were united by a common thread: The FBI had looked at one of the accused assailants, including an intensive 10-month probe of Orlando gunman Omar Mateen.

Yet each remained free to inflict damage, leaving federal investigators to wonder on Tuesday whether their long-held fear of a series of “lone wolf” attacks on U.S. soil was coming to fruition. “Clearly, Orlando in particular represents one of the FBI’s great nightmares: someone they looked at who ultimately goes out and carries out a successful attack,’’ said John Cohen, a former counterterrorism coordinator for the Department of Homeland Security.

Few in Washington’s tight-knit homeland security community found fault with the bureau, saying FBI agents are swamped with terrorism cases, bound by constitutional and privacy restrictions, and facing dangerous new threats from the Islamic State. “The country might expect the FBI to have a perfect record, and they strive for that,’’ said Sean M. Joyce, a former FBI deputy director. “But today we are facing a new and different threat, and the challenge is to find every needle in the haystack. That’s an incredibly difficult task.”

But others said the carnage in Orlando, where 49 people were killed and more than 50 injured, should prompt a reevaluation of the balance the government has been trying to strike between security and civil liberties since the Sept. 11, 2001, attacks. David Gomez, a former senior FBI counterterrorism official in Seattle, wrote in an online posting titled “How Did The FBI Miss Omar Mateen?” that “perhaps it is time to revisit” the basic legal standard that the FBI requires probable cause of a likely crime to open full-scale investigations.

And James McJunkin, who once headed the FBI’s counterterrorism division, said that if agents didn’t dig deep enough in Orlando, it was probably because they were hampered by FBI guidelines. He said in preliminary investigations, for instance, there is a cap on the number of hours agents can conduct surveillance.

“Those are rules or guidelines that were written by lawyers who don’t have the responsibility or accountability for doing thorough investigations,’’ McJunkin said. The agents probing Mateen, he added, “ran out of leads based upon the tools that they applied. But if they had more tools, would they have found more leads?’’

Experts who study terrorism said that the bureau might require more agents and analysts to fight a metastasizing terror threat in which potential recruits are flooded with information online. FBI officials have said they have nearly 1,000 open investigations involving the Islamic State in all 50 states.

Seamus Hughes, deputy director of the program on extremism at George Washington University, said the FBI might have a “resource issue” and called for a “wholesale review of the FBI’s polices and procedures when it comes to these investigations.” He added that the bureau’s performance in the Orlando, Boston and Texas cases seemed satisfactory.

“If these people weren’t investigated at all, that would tell me something about the system and some level of failure,’’ he said. “The fact that they were investigated tells me there are some red lights that are blinking on these things, which is very important.’’

FBI Director James B. Comey said this week that the bureau has sufficient resources. But the FBI has repeatedly moved hundreds of agents from its criminal division to assist in counterterrorism operations when there is a spike in threats.

Comey also said the FBI is reevaluating its contacts with Mateen to see whether any clues were missed.

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

Then, in July 2014, Mateen surfaced in another investigation into the first American to die as a suicide bomber in Syria. In both investigations, the FBI found no evidence that Mateen had committed a crime or intended to break the law.

The FBI also ended its 2011 investigation of Tamerlan Tsarnaev, one of two brothers who would place bombs near the finish line of the Boston Marathon in 2013, killing three people and injuring more than 200. Russian authorities had told the bureau that Tsarnaev was an adherent of Islamist groups and was preparing to travel to Russia to join militants in Dagestan and Chechnya. Investigators closed the probe after three months, having found no link to terrorism, according to a 2014 inspector general’s report.

And in the Texas shooting, the FBI began investigating gunman Elton Simpson, of Phoenix, in 2006, and closed the case after he was convicted of making false statements to federal officials and sentenced to probation. They began monitoring him again before the May 2015 attack. Simpson and another man were killed by police after opening fire at the Muhammad drawing contest, striking a security guard in the leg.

William McCants, a senior fellow at the Brookings Institution and an expert on violent jihadism, said the FBI acted appropriately in all three instances. “We don’t allow the FBI overweening power in detaining or keeping open investigations on people,’’ he said. “It’s tough to assign blame to the FBI here, given that they were just abiding by the strictures we have placed on them.’’