The attack on a gay club in Orlando in which 50 people were killed and more than 50 wounded — now the largest mass shooting in U.S. history — demonstrates how potential threats are escaping the FBI’s vast counterterrorism dragnet.

While it’s unclear whether gunman Omar Mateen’s inspiration was hatred of gays, the Islamic State, or something else, attackers like him are the intended targets of the FBI’s post-9/11 prevention program. Federal law enforcement’s top priority today is to stop the attacker of tomorrow.

But Mateen’s mass shooting is an example of how dangerous men slip past the FBI’s watch while federal agents focus on targets of questionable capacity.

Born in the United States to parents from Afghanistan, Mateen was reportedly a “known quantity” to the FBI.

According to the Daily Beast, whose reporter quoted an unnamed “senior law enforcement source,” Mateen was a person of interest to the FBI in 2013 and again in 2014. The Intercept has been unable confirm independently from sources that Mateen had been under FBI investigation during those years.

If the FBI had in fact investigated Mateen, his capacity for violence would have been easily verified: He had a state firearms license.

With connections to homes in Martin and St. Lucie counties, Mateen would have fallen under the jurisdiction of the FBI’s Miami office, which has been among the bureau’s most active and aggressive counterterrorism units.

The Miami FBI investigated the so-called Liberty City 7 in one of the earliest and most controversial post-9/11 counterterrorism stings, and prosecutors in Florida’s Southern District have prosecuted dozens on terrorism-related charges in the last 15 years.

The Miami FBI has not responded to a request to comment on whether it has investigated Mateen.

For more than a year ending in April — a time during which investigators will now be looking for any clues from Mateen that might have been missed — the FBI in Miami focused on a counterterrorism sting that targeted James Medina, a homeless man with mental problems.

An FBI informant recorded conversations with Medina in which he expressed interest in attacking a Jewish community center. Medina did not have weapons or connections to international terrorists. In fact, he was known in homeless circles, not terrorism ones.

“C’mon, man, no terrorist is homeless,” Rick Wallace, who volunteered to serve lunch to homeless people in South Florida, told Local 10 ABC investigative reporter Bob Norman. “Who did he not threaten? He was insane.”

According to the FBI’s affidavit, the informant, not Medina, came up with the idea of crediting the planned attack to the Islamic State.

“You can do all that,” Medina told the informant. “Yeah, we can print up or something and make it look like it’s ISIS here in America. Just like that.”

Nearly a year before Medina’s arrest, the FBI’s Miami office arrested another supposed terrorist, 23-year-old Cuban-American Harlem Suarez, also known as Almlak Benitez, whom former co-workers described as “a little slow.” The government alleged that Suarez conspired with an FBI informant to bomb a beach in Key West in support of the Islamic State. The FBI provided a fake backpack bomb.

Does the FBI’s focus on men like Medina and Suarez — questionable targets of questionable mental fitness — prevent agents from identifying and investigating armed and dangerous men like the one behind what is now America’s worst mass shooting?

It’s a question the FBI, which has faced little congressional scrutiny over its counterterrorism program, has never been forced to answer.

The Orlando shooting isn’t the first case to raise this question. In 2011, when the FBI investigated Boston Marathon bomber Tamerlan Tsarnaev, agents did not deem him a threat.

Instead, at about the same time, the Boston FBI started a nine-month sting operation against Rezwan Ferdaus, who had no weapons and no connections to international terrorists, and whose mental wellness had deteriorated so much that he was wearing adult diapers at the time of his arrest on terrorism charges.