SCOTTSDALE, Arizona — YouTube's chief executive apologized on Monday for the hurt she said is caused by videos with anti-gay slurs, but said the company was right to let the videos remain on its service.

CEO Susan Wojcicki, in an on-stage interview at the tech-focused Code Conference in Scottsdale, Arizona, spoke publicly for the first time since YouTube last week imposed a stricter ban on hate speech, including videos that promote ideas of racial superiority.

But rather than being lauded for tackling Nazism, Wojcicki was met with a barrage of questions about videos she has decided to leave up. The questions were prompted by journalist Carlos Maza launching a campaign last month to bring attention to homophobic abuse and harassment he says he received from a conservative YouTube personality.

Maza said that he has been the subject of targeted harassment for years that included both anti-gay and anti-Mexican slurs. Several activists are lobbying to ban YouTube's parent company, Google, from the San Francisco Pride march this month over what they see as the service's inaction.

"I know the decision we made was very hurtful to the LGBTQ community," Wojcicki said. "That was not our intention at all. We're really sorry about that."

But, she added, YouTube looked at the videos in question, "and in the end, we decided it was not violative of our policy."

"I do agree this was the right decision," she said.

More from NBC News:

'Our bodies, our choice': N.Y. bill would decriminalize sex work

U.S. Customs says traveler images exposed in cyberattack

Deadly New York helicopter crash brings 'a level of PTSD from 9/11'

Wojcicki, a high-profile Silicon Valley executive, faced a skeptical crowd at the annual conference for tech and media professionals. When Ina Fried, a journalist from Axios, suggested during a question-and-answer period that Wojcicki wasn't actually sorry, the audience greeted the question with applause.

YouTube, like Facebook and other online services that rely on users for content, is facing growing scrutiny over material that shows violence, promotes hatred or is objectionable in other ways. The service's rulebook bans harassment, for example, but only when it is "malicious."

Wojcicki said that YouTube has a "high bar" for what counts as malicious material, and that the service faced a challenge in being consistent. She said the same rules needed to apply across the board, including to late-night comedy shows or rap music videos.