SAN FRANCISCO — Facebook is taking steps to stop marketers from being able to target advertisements in offensive ways on the social network through its self-service ad-buying system.

"The fact that hateful terms were even offered as options was totally inappropriate and a fail on our part," Facebook's chief operating officer Sheryl Sandberg said in a Facebook post.

Last week Facebook acknowledged it was possible to target ads to people who have expressed interest in such anti-Semitic topics as "jew hater," "how to burn jews" or "History of 'why jews ruin the world.'"

Investigative news organization Pro Publica said it paid $30 to reach nearly 2,300 people with anti-Semitic interests through three "promoted posts" on the self-service ad buying system. It says Facebook approved all three ads within 15 minutes. Most of Facebook's ads are placed through an automated system that allows marketers to select who they'd like to reach.

After the news organization contacted the giant social network, Facebook removed the anti-Semitic categories and says it will remove all self-reported targeting fields.

"If someone self-identified as a ‘Jew-hater’ or said they studied ‘how to burn Jews’ in their profile, those terms showed up as potential targeting options for advertisers. Seeing those words made me disgusted and disappointed — disgusted by these sentiments and disappointed that our systems allowed this," Sandberg wrote.

Facebook said it would tighten enforcement to ensure that content that violates its community standards cannot be used to target ads. That includes attacks on people based on race, ethnicity, national origin, religious affiliation, sexual orientation, sex, gender or gender identity, disabilities or diseases, Sandberg said.

It will also add more human oversight to the automated ad-placing system so new ad targeting options can be reviewed to weed out offensive terms. And Facebook is working on a program that would allow Facebook users to report ads.

"If we discover unintended consequences in the future, we will be unrelenting in identifying and fixing them as quickly as possible," Sandberg wrote.

Last week Facebook disabled the targeting option for ads. It is now allowing targeting again for 5,000 options such as "nurse" or "teacher," terms that Sandberg said were most commonly used and were approved by people, not machines.

Jonathan A. Greenblatt, CEO of the Anti-Defamation League, said he spoke with Facebook last week and was pleased to see the company take "immediate, meaningful action."

Yet some are openly questioning why it has taken so long for Facebook and its advertising business, overseen by Sandberg, to take steps to root out discrimination.

Philanthropist and entrepreneur Pierre Omidyar hailed Facebook's pledge to restrict ad targeting as progress but said "so long as Facebook permits secret, targeted paid advertising, it will be abused."

It's the latest controversy to emerge for Facebook, whose advertising business has been under intense scrutiny since the Silicon Valley company disclosed that it discovered approximately $100,000 ads by fake accounts, likely out of Russia, that sought to sow political discord during the 2016 presidential election.

On Thursday, CEO Mark Zuckerberg vowed to prevent "bad actors" from again using the giant social network to manipulate voter sentiment during elections. Facebook will provide Congress with more than 3,000 Facebook ads bought by entities linked to the Russian government.

Facebook users have complained, for instance, that Facebook has not done enough to shield them from sexual assaults, shootings and suicides appearing on its video streaming feature Facebook Live. The company said in May that it would hire 3,000 more people to review videos for graphic or inappropriate material and to make videos easier for users to flag as violent.