Google is facing a wave of angry customers after advertisements from major brands and the U.K. government appeared alongside content from hate preachers and extremist groups.

The British government has summoned the tech firm to explain itself after a newspaper investigation showed that taxpayer-funded ads were used on inappropriate content including videos from former Ku Klux Klan leader David Duke.

"We have placed a temporary restriction on our YouTube advertising pending reassurances from Google (GOOG) that government messages can be delivered in a safe and appropriate way," the British government said in a statement.

The investigation published by The Times showed that ads from the BBC, Transport for London, Visit Scotland, L'Oreal (LRLCF), the Financial Conduct Authority, Honda (HMC), supermarket chain Sainsbury's and The Guardian all appeared next to objectionable content on YouTube.

In addition to former Klan leader Duke, the ads were used alongside content from far-right party Britain First and an organization of Polish nationalists, as well as a smattering of religious extremists and controversial hate preachers.

Google said in a statement that it has "strict guidelines" that define where ads should appear.

"We accept that we don't always get it right, and that sometimes, ads appear where they should not. We're committed to doing better, and will make changes to our policies and brand controls for advertisers," it added.

Related: Google is going to start showing you more ads

Some companies, however, said they were taking steps to protect their brands.

L'Oreal said it was "horrified" that its advertisements had appeared with such "extreme" and "negative" content. It said the problem seems to have occurred after Google incorrectly categorized some of its YouTube inventory.

"We are taking immediate action to remedy this issue and will be working yet more closely with Google to prevent this from happening in the future," a company spokeswoman said in a statement.

David Pemsel, chief executive of The Guardian, said it was "completely unacceptable" for its advertising to be misused.

In a letter sent to Google executive Matt Brittin, he said that it was vital for Google to "uphold the highest standards in terms of openness, transparency, and measures to avoid advertising fraud."

Related: Google's Europe boss doesn't know what he is paid

"It is very clear that this is not the case at the moment," he wrote.

Google and Facebook (FB) own huge chunks of the digital advertising business, and major brands are spending an increasing share of their ad budgets on their platforms. Many of their gains have come at the expense of newspapers and magazines.