SAN FRANCISCO — In July 2013, a broadcaster affiliated with the Islamist group Hezbollah posted a threatening video on Facebook, YouTube and Twitter. It featured gun-toting militants practicing an ambush to kidnap Israeli soldiers. The message: This is how we kill you.
In December, the broadcaster posted another video that showed how Hezbollah’s social media strategy had changed. This one contained close-up footage of Israeli soldiers on patrol, with no Hezbollah members visible. The message was also dialed back: We are watching you.
Hezbollah is among dozens of groups classified by the United States as terrorist entities that have learned how to stay a step ahead of the social media giants. In the past, Facebook, YouTube and Twitter have taken down the official pages of these militant groups dozens of times and banned their accounts.
But Hamas and Hezbollah, in particular, have evolved by getting their supporters to publish images and videos that deliver their message — but that do not set off the alarm bells of the social media platforms. Today, the groups mostly post images of festive parades and religious celebrations online, as well as videos of speeches by their leaders.
That has allowed Hamas and Hezbollah, as well as groups like the East African-based Shabab, to proliferate largely unchecked on social media, even as a clampdown by Facebook and others has neutered the online presences of the terror organizations that are the most threatening to the West — the Islamic State and Al Qaeda.
The change thrusts Facebook, YouTube and Twitter into complicated territory. Unlike Al Qaeda and the Islamic State, Hamas and Hezbollah are political forces in their territories. Hamas has governance duties in the Gaza Strip, in addition to its militancy. Hezbollah is a recognized political party in Lebanon. And by no longer posting overtly violent material, the groups arguably merit a different treatment by the social media companies.
Facebook and others said they typically adhered to the designations set by the United States on terrorist groups, citing how any online presence — even a seemingly innocuous or benign post — helps legitimize them and increase their visibility. Even so, it has proved difficult for the companies to follow the rules they set for themselves, precisely because the groups can be deemed political organizations or terrorist entities, depending on one’s perspective.
“There has to be a differentiation in the way we understand how different groups use social media,” said Lina Khatib, the head of the Middle East and North Africa program at Chatham House, the London think tank.
That complexity has dismayed Israel, which has fought several wars against Hamas and Hezbollah. Since 2015, Israeli legal groups and their partners in the United States have filed at least three lawsuits against Facebook, accusing it of turning a blind eye to how the militant organizations use the social network.
In November, the Israel legal center Shurat HaDin, which previously had filed some of these cases, threatened to sue Facebook again if the company continued to let a Hamas-linked broadcaster share content on the site.
“The mere fact that Hamas affiliates still have Facebook pages shows you that Facebook does not care,” said Nitsana Darshan-Leitner, founder of Shurat HaDin, adding that she would not hesitate to take her cases to the Supreme Court. “We argue that anything at all Hamas posts is terrorist content.”
The social media companies could face other penalties from the thriving activity of the groups and their supporters on their networks. The European Union is considering a new law that would fine tech companies if they did not remove terrorist content from their sites within one hour of being notified of its presence.
Brian Fishman, Facebook’s global head of counterterrorism, said the social network had zero tolerance for any group that the United States listed as a terrorist entity. He added that the company had removed 99 percent of Islamic State and Al Qaeda content largely by using artificial intelligence.
But Mr. Fishman also suggested that posts by organizations like Hezbollah could fall through the cracks because the groups stopped short of issuing direct threats of violence.
“If we have to make a hard prioritization decision, we’re going to focus on stuff that directly calls for violence,” he said. “The blunt truth is that it is very difficult” to weed out.
Twitter did not respond to questions about activity by Hezbollah and other militant groups on its service. It referred to a recent transparency report that detailed how it had suspended 205,156 accounts for promoting terrorism in the first half of 2018. A YouTube spokeswoman said the company had removed channels for promoting violence or violent extremism and barred groups that the United States labeled terrorists.
Hezbollah and Hamas did not respond to requests for comment.
The issue of militant groups on social media came to the fore in 2013 when the Islamic State grabbed global attention by posting videos of beheadings and bombings online. The Islamic State also used the channels to spread propaganda and to recruit followers.
Groups like Hamas and Hezbollah do not primarily use social media to recruit, Ms. Khatib said, but to intimidate their enemies and rally their supporters.
Tech companies said they had always barred these groups from their platforms. But the organizations continued posting to social media anyway.
Around 2015, the tech companies started making some headway in removing Islamic State and Qaeda content, according to counterterrorism experts. The companies created dedicated teams and used A.I. tools to find and eliminate posts from the Islamist groups.
But the companies did not reckon with the organizations’ abilities to manipulate their platforms by posting material that went up to, but did not cross, the line of being flagged by users or outside observers. Many of the groups also use proxies, such as media organizations or local charities, to post content on the platforms for them.
Hezbollah and Hamas, in particular, have honed their social media strategies to foster their online presences.
Hezbollah, which now has no official accounts on the big social media platforms, largely shares through Al Manar, a broadcaster with strong pro-Hezbollah ties. Al Manar has a Twitter feed, which is followed by 481,000 people. Content from the channel is easy to find on YouTube, including many lengthy speeches by Hezbollah’s leader, Hassan Nasrallah.
A recent search on YouTube for Al Manar in Arabic yielded more than 37,000 results. Many of those videos have tens of thousands of views and have been on the site for years.
Hamas enjoys a similar widespread presence on Facebook, YouTube and Twitter. The group has a Twitter feed, though not a Facebook page or a YouTube account. Many of its leaders have personal social media accounts, where they post commentaries, photos and videos.
The Hamas television station, Al Aqsa, also has a Twitter feed and a Facebook page. And on Instagram, the photo-sharing site owned by Facebook, popular Arabic-language hashtags promoting Hamas feature thousands of propaganda videos and images.
When conflicts with Israel escalate, Hamas’s presence on social media also rises. In August, Israel accused Hamas members of posing as attractive women on Instagram to lure Israeli soldiers into sharing details about themselves and to download malware.
Israel called the campaign Operation Broken Heart. It showed, Israeli officials said, how dangerous it was to allow militant organizations to use social media.