SAN FRANCISCO — For years, one of the main grievances among Twitter users has been the ability of anonymous trolls to send abusive comments to other people on the service.

But on Tuesday, Twitter barred one of the most egregious and consistent offenders of its terms of service, Milo Yiannopoulos, in an attempt to show that it is cracking down on abuse.

The ban against Mr. Yiannopoulos, a technology editor at the conservative news site Breitbart and known by his Twitter handle, @Nero, follows a campaign of prolonged abuse against Leslie Jones, a comedian and co-star of the recently released “Ghostbusters” movie. The film and its stars have come under fire from various parts of the internet for months, after it was first revealed that the reboot of the 1984 film would feature an all-female cast.

Ms. Jones in particular has borne the brunt of the online abuse in recent days, especially since the release of “Ghostbusters” in the United States on Friday. Hundreds of anonymous Twitter commenters hurled racist and sexist remarks at the star’s Twitter account, rallied and directed by Mr. Yiannopoulos this week. The news media picked up on the abuse after Ms. Jones began retweeting screenshots of the litany of comments sent to her over the past few days.