An online “code of conduct” aimed at fighting hate speech has been launched by the European Union in conjunction with four of the world’s biggest internet companies.

Facebook, Twitter, YouTube and Microsoft have all been involved in the creation of the code, which is particularly aimed at fighting racism and xenophobia across Europe. Such efforts are hampered by varying enforcement in different countries, something the code is tackling.

It also encourages the social media companies to take quick action as soon as a valid notification is received.

A slim document, the code of conduct isn’t legally binding for the internet companies, even though many of its policies are already covered by other EU legislation such as the e-commerce directive. Instead, it establishes “public commitments” for the companies, including the requirement to review the “majority of valid notifications for removal of illegal hate speech” in less than 24 hours, and to make it easier for law enforcement to notify the firms directly.

Vĕra Jourová, the EU commissioner for justice, consumers and gender equality, led the creation of the code, and placed it in the context of the attacks in Paris and Brussels. “The recent terror attacks have reminded us of the urgent need to address illegal online hate speech,” she said. “Social media is unfortunately one of the tools that terrorist groups use to radicalise young people and racist use to spread violence and hatred.

“This agreement is an important step forward to ensure that the internet remains a place of free and democratic expression, where European values and laws are respected.”

The definition of hate speech covered by the code of conduct is narrow: it is defined in the document as “all conduct publicly inciting to violence or hatred directed against a group of persons or a member of such a group defined by reference to race, colour, religion, descent or national or ethnic origin”.

That ban is counterbalanced by the right to freedom of expression, which, the code highlights, covers “not only… ‘information’ or ‘ideas’ that are favourably received or regarded as inoffensive or as a matter of indifference, but also to those that offend, shock or disturb the state or any sector of the population”.

All the internet companies that signed the code of conduct emphasised the tension themselves. Google’s public policy and government relations director, Lie Junius, said “We’re committed to giving people access to information through our services, but we have always prohibited illegal hate speech on our platforms… We are pleased to work with the Commission to develop co- and self-regulatory approaches to fighting hate speech online.”

Monika Bickert, head of global policy management at Facebook, said: “With a global community of 1.6 billion people, we work hard to balance giving people the power to express themselves whilst ensuring we provide a respectful environment. As we make clear in our Community Standards, there’s no place for hate speech on Facebook.”

Twitter’s Karen White, the head of public policy for Europe, said: “Hateful conduct has no place on Twitter and we will continue to tackle this issue head on alongside our partners in industry and civil society. We remain committed to letting the tweets flow. However, there is a clear distinction between freedom of expression and conduct that incites violence and hate.”

The code of conduct represents the first major attempt to codify how technology firms should respond to hate speech online. But the limited scope leaves many aspects of online abuse still uncovered: harassment on gender grounds, for instance, is not considered hate speech according to the code of conduct. In Britain, a cross-party campaign launched last week, with Facebook’s backing, is calling for contributions on how to reduce misogynist abuse online.