Maria Waqar, an Indiana University graduate student who has interviewed dozens of female lawmakers in Pakistan for her research on the legislature, said the abuse directed at Ms. Wazir was not surprising. She said that “the web is littered with websites, videos and message boards dedicated to objectifying and degrading women parliamentarians in particular and women in general.”

Image Qandeel Baloch, a Pakistani social media star, was strangled last year by her brother, who said he was incensed over her risqué Facebook posts. Credit... M Jameel/Associated Press

In a survey of women in 17 Pakistani universities, published by the Digital Rights Foundation in May, 34 percent said they had experienced online harassment and abuse. The actions included cyberstalking, bullying, and the leaking and manipulation of personal information and pictures.

Many women reported threats of physical violence and vandalism, blackmail, sexual remarks and false accusations meant to humiliate, threaten or discredit them. Seventy percent of the women surveyed said they were afraid to post their pictures on social media websites.

The country is taking some steps to address the problem. Last year, Parliament passed the Prevention of Electronic Crimes Act, which was widely promoted as a tool to curb online sexual harassment. Pakistan’s first cyber harassment help line, also set up last year, received 763 complaints in the form of calls, emails and Facebook messages from Dec. 1 to May 31.

In July, a man was sentenced to 12 years in jail for blackmailing a woman in the northern city of Peshawar. And in two cases still to be decided, a university professor in the port city of Karachi was arrested on charges of setting up fake Facebook pages and publishing doctored pictures of a female colleague, and two boys were arrested in 2015 on charges of using a fake Facebook profile to harass and blackmail up to 50 girls in Peshawar.

Yet online activity has still led to real-life violence, including in July of last year, when Qandeel Baloch, a social media sensation, was strangled in what is known as an honor killing. When Ms. Baloch’s brother was arrested in connection with her death, he said at a news conference that he had killed her because he was incensed over her risqué Facebook posts.