1. The following shall be punished with a prison sentence of one to four years and a fine of six to twelve months:
a) Those who publicly encourage, promote or incite directly or indirectly hatred, hostility, discrimination or violence against a group, a part thereof or against a specific person because of their membership in that group, for racist, anti-Semitic, anti-Gypsy or other reasons relating to ideology, religion or beliefs, family situation, the membership of its members in an ethnic group, race or nation, their national origin, their sex, sexual orientation or identity, for reasons of gender, aporophobia, illness or disability.
b) Those who produce, create, possess for the purpose of distributing, facilitate access to third parties, distribute, disseminate or sell writings or any other kind of material or media that, due to their content, are suitable to foster, promote or incite directly or indirectly hatred, hostility, discrimination or violence against a group, a part of it, or against a specific person because of their membership in that group, for racist, anti-Semitic, anti-Gypsy reasons or other reasons related to ideology, religion or beliefs, family situation, the belonging of its members to an ethnicity, race or nation, their national origin, their sex, sexual orientation or identity, for reasons of gender, aporophobia, illness or disability.
c) Those who publicly deny, seriously trivialize or glorify the crimes of genocide, crimes against humanity or crimes against persons and property protected in the event of armed conflict, or glorify their perpetrators, when they have been committed against a group or part thereof, or against a specific person because of their membership in it, for racist, anti-Semitic, anti-Gypsy reasons, or other reasons relating to ideology, religion or beliefs, family situation or the membership of its members in an ethnic group, race or nation, their national origin, their sex, sexual orientation or identity, for reasons of gender, aporophobia, illness or disability, when in this way a climate of violence, hostility, hatred or discrimination against them is promoted or fostered.
2. The following shall be punished with imprisonment for six months to two years and a fine of six to twelve months:
a) Those who injure the dignity of persons through actions that entail humiliation, contempt or discrediting of any of the groups referred to in the previous section, or of a part thereof, or of any specific person by reason of their membership in them for racist, anti-Semitic, anti-Gypsy or other reasons relating to ideology, religion or beliefs, family situation, the membership of its members in an ethnic group, race or nation, their national origin, their sex, sexual orientation or identity, for reasons of gender, aporophobia, illness or disability, or who produce, create, possess with the purpose of distributing, facilitate access to third parties, distribute, disseminate or sell writings or any other kind of material or media that, due to their content, are suitable for injuring the dignity of persons by representing serious humiliation, contempt or discrediting of any of the aforementioned groups, or of a part thereof, or any specific person by reason of their membership in such groups.
b) Those who glorify or justify, through any means of public expression or dissemination, crimes committed against a group, a part thereof, or against a specific person by reason of their membership in that group for racist, anti-Semitic, anti-Gypsy, or other reasons related to ideology, religion or beliefs, family status, the ethnicity, race, or nationality of its members, their national origin, sex, sexual orientation or identity, gender, aporophobia, illness, or disability, or those who have participated in their commission.
These acts shall be punished with a prison sentence of one to four years and a fine of six to twelve months when such actions promote or foster a climate of violence, hostility, hatred, or discrimination against the aforementioned groups.
3. The penalties provided for in the preceding sections shall be increased by half when the acts have been carried out through a social media platform, via the internet, or through the use of information technologies, in such a way that they are accessible to a large number of people.
4. When the acts, in view of their circumstances, are likely to disturb public peace or create a serious sense of insecurity or fear among the members of the group, the penalty shall be increased by half, and may be further increased to the next higher degree.
5. In all cases, the penalty of special disqualification from educational professions or occupations, in the teaching, sports, and leisure fields, shall also be imposed for a period of between three and ten years longer than the term of imprisonment imposed, if any, in the judgment, taking into account the seriousness of the crime, the number of offenses committed, and the circumstances of the offender.
6. The judge or court shall order the destruction, erasure, or rendering unusable the books, files, documents, articles, and any other type of medium that are the object of the crime referred to in the preceding paragraphs or by means of which it was committed. When the crime has been committed through information and communication technologies, the removal of the content shall be ordered.
In cases where the content referred to in the preceding paragraph is disseminated exclusively or predominantly through an internet access portal or information society service, the blocking of access or the interruption of the service shall be ordered.