YouTube has decided to ban content promoting Nazi ideology from its service.

The company confirmed it would no longer host videos that glorified fascist views or material that denied the existence of the Holocaust, following years of criticism over its role in spreading far-right hate and conspiracy theories.

The video-sharing website, which is owned by Google, said on Wednesday it would ban any videos “alleging that a group is superior in order to justify discrimination, segregation or exclusion based on qualities like age, gender, race, caste, religion, sexual orientation or veteran status”.

This would include “inherently discriminatory” videos promoting Nazi ideology or content denying that well-documented violent events took place, such as the deaths of millions of Jews in the second world war or the Sandy Hook school shooting in the US.

Platforms such as YouTube have traditionally taken a light-touch approach to hosted material, adopting a broad defence of free speech to justify the extremist views users post.

This has become increasingly untenable under relentless media and public scrutiny, and pressure from advertisers. YouTube banned a handful of high-profile extremists, including Alex Jones of Infowars, in the last year.

Much of the criticism has been aimed at YouTube’s algorithm-driven recommendation system, which helps keep people on the site by suggesting new videos they might be interested in. Critics have said it leads people towards more and more extreme and conspiratorial videos, and that this can incentivise users to produce more extreme material to try to drive up view counts and earn a larger slice of the ad revenue.

YouTube said changes to its algorithm introduced in the US in January had more than halved the number of views that “borderline content and harmful misinformation” receives from recommendations. It defined borderline content as including “videos promoting a phoney miracle cure for a serious illness, or claiming the earth is flat”, and said a similar system would be rolled out elsewhere in the world this year.

The company also said it would include more material from authoritative sources, such as traditional TV channels, if users were watching borderline or conspiratorial content about a news event.

The changes could face challenges from conservative politicians, who have risen to power under the social media free-for-all. Donald Trump and leading Republican senators have expressed concern about the prospect of censorship by sites such as YouTube, and the White House has launched a tool encouraging people to contact the government if they feel they have been banned or suspended from a social media service for political reasons.

The company also confirmed on Wednesday that it would not be taking action against a prominent rightwing YouTuber who repeatedly targeted homophobic abuse at a journalist, arguing that the “criticism” counted as debate rather than harassment.

YouTube also remains the only major social network which allows material from the far-right activist Tommy Robinson, who has been banned from Facebook, Instagram, and Twitter.