For weeks, Syrian democracy activists have used Facebook and Twitter to promote a wave of bold demonstrations. Now, the Syrian government and its supporters are striking back — not just with bullets, but with their own social-media offensive.

Mysterious intruders have scrawled pro-government messages on dissidents’ Facebook pages. Facebook pages have popped up offering cyber tools to attack the opposition. The Twitter #Syria hashtag — which had carried accounts of the protests — has been deluged with automated messages bearing scenes of nature and old sports scores.

“There is a war itself going on in cyberspace,” said Wissam Tarif, head of the Middle East human rights organization Insan, whose Web site has been attacked.

Syria offers just one example of the online backlash in countries ruled by authoritarian regimes. Although social media sites have been lionized for their role in the Arab Spring protests, governments are increasingly turning the technology against the activists.

“In the same way that, a few years ago, it became commonplace to talk about Web 2.0, we’re now seeing Repression 2.0,” said Daniel B. Baer, a deputy assistant secretary of state for democracy, human rights and labor.

Secretary of State Hillary Rodham Clinton has expressed alarm about the trend, which began years ago in places such as China and Iran and has spread recently. “In a number of countries, democracy and human rights activists and independent bloggers found their e-mails hacked or their computers infected with spyware that reported back on their every keystroke. Digital activists have been tortured so they would reveal their passwords,” she said last month.

For several years, Congress has given the State Department millions of dollars annually to provide technology to help activists evade Internet censorship by oppressive governments. But diplomats are increasingly realizing that the threat goes beyond blocked Web sites.

In several Arab countries where popular rebellions have erupted, activists have discovered anonymous death threats arriving via e-mail, Facebook and Twitter.

In Bahrain, Mohammed al-Maskati, a 24-year-old human rights defender, became the target of a smear campaign on Facebook. Government supporters posted his home address and picture on various forums and urged that he be killed, Maskati said in an interview.

“Some people say, ‘We will kill you, and we will do this and this’ — bad words — ‘if you don’t stop [defending] human rights,’ ” he said in a telephone interview.

Maskati is hardly alone. “A lot of leading, moderate bloggers have had to flee the country because of threats to their person online,” said Robert Guerra, head of the global Internet program at Freedom House, a pro-democracy group.

The Bahraini Embassy did not respond to requests for comment.

When it faced swelling protests earlier this year, Egypt’s government effectively shut down Internet access across the entire country. Other governments have taken to the Web with their own campaigns. China has the “50-cent party,” named for the fee its members allegedly receive when they flood sites with propaganda. The Iranian Cyber Army, run by Iran’s Revolutionary Guard Corps, hacks into opposition and news sites, according to Freedom on the Net 2011, a report by Freedom House.

In Sudan, young people inspired by the uprisings in Egypt and Tunisia have used social media to organize sporadic demonstrations against the longtime ruling party.

Osman Hummaida, a New York-based activist who runs the African Center for Justice and Peace Studies, said Sudanese authorities detained demonstrators and pressured them — sometimes under torture — to give up their Facebook and other account passwords.

“Through that, they started trying to sabotage the whole network, by sending false information” about pro-democracy gatherings, he said, including wrong dates and locations.

The actions had a chilling effect on the protests, which have not gained momentum. Although young Sudanese have not given up, “they are more careful in using the Internet,” Adil Abdel Aati, an opposition party member, said in a Skype message.

A Sudanese official, Mandur al-Mahdi, was quoted recently in the Sudanese media as saying that ruling party “cyber-jihadists” had launched “online defense operations” to crush any effort to topple the government.

But Sudan’s charge d’affaires in Washington, Fatahelrahman Ali Mohammed, said authorities were simply trying to get their message out.

“It is something natural that the government would encourage the supporters to go to the Internet,” he said. “But I don’t have information that there is a campaign which is declared.” He said he also was unaware of anyone being forced to give up their passwords.

Syria’s government, which has long been accused of spying on Internet users, appeared to signal leniency when it lifted its ban on Facebook, YouTube and Twitter in February.

But since then, it has dispatched tanks and snipers to put down a wave of peaceful demonstrations. It has cut off electricity and phone service to cities hit by protests, crippling Internet use, and arrested bloggers. And there are signs of a somewhat more sophisticated campaign.

Recently, some Internet users in Syria discovered that their Facebook security certificates had been switched, allowing outsiders to track their log-in information and online activity.

“We don’t know who’s doing it. We assume it’s the Syrian Telecom,” which is affiliated with the government, said Jillian York, director of international freedom of expression at the San Francisco-based Electronic Frontier Foundation.

After activists posted online videos of soldiers attacking protesters, government supporters began to upload footage that they said shows that the protesters are Islamist extremists or are using weapons, according to Tarif, the human rights activist.

“They run their own campaign to discredit the campaign of the revolution,” he said. In one case, activists say, a video purportedly showing Syrian protesters attacking police officers turned out to be footage from Iraq.

Syrian regime supporters also have been posting their version of events on foreign media sites, including that of The Washington Post.

The Syrian Embassy in Washington did not return calls for comments.

To help the embattled activists, Baer said, the State Department has funded “cyber-defense” training for 5,000 people in the past two years. The department is stepping up its efforts, with plans for additional training and new gizmos — such as a digital “secret handshake” to enable Internet users to know who they are chatting with online.

Guerra said users are often unaware of the extent to which governments monitor them.

“They’re just happy there’s Internet. They are oblivious as to how insecure it is for them,” he said. “That’s a huge problem.”

Staff writers Michael Birnbaum in Cairo and Liz Sly in Beirut and special correspondent Rebecca Hamilton contributed to this report.