Even if agents had tied Mr. Cruz to the YouTube post, the authorities probably would have questioned him or his family and friends but would have been unable seize his gun without a court order.

“I hope he would have been interviewed by the F.B.I. or referred to the local police assuming he was identified,” said Eugene Casey, a veteran former F.B.I. agent. “I would have done my best to identify the individual who made the threat, but he could have posted it to YouTube from a public computer in a library or somewhere else.”

The case highlights the difference between how the United States government handles terrorism and other kinds of attacks. Over the past decade and a half, the F.B.I. and other agencies have established broad power to pre-emptively investigate people in matters of international terrorism — raising expectations that the government should be able to prevent attacks.

“If they had gotten a tip that someone was going to shoot up the embassy in Cairo, they would have been all over it. But they don’t know what to do with it when it’s domestic,” said Chris Fialko, a prominent North Carolina defense lawyer who has handled numerous F.B.I. investigations. “We are not Big Brother yet. They have to get search warrants. In America, the Bill of Rights still applies.”

The F.B.I. is gathering information about Mr. Cruz’s social media posts, along with his movements and conversations, Mr. Lasky said. YouTube did not respond to a request for further information.

Mr. Bennight said he did not fault the F.B.I. for failing to stop the shooting.

“We live in a country where you can’t just lock people away for saying something,” he said. “You can’t just stuff somebody in a black hole because they said something that makes you uncomfortable. I believe the F.B.I. took it seriously. I hope that they followed up.”

If the bureau missed an opportunity to prevent the shooting, it could find itself in the cross hairs of Congress, which has criticized the F.B.I. for failing to stop the 2013 Boston Marathon bombing and the 2009 mass shooting at Fort Hood in Texas. In the Texas attack, the shooter was known to the F.B.I., as was one of the brothers who carried out the Boston bombing.