Ytterby's junior high school cites guidance in the national curriculum that pupils must be able to apply basic democratic values in society, reported Sveriges Radio's 'Ekot' news programme.
"That's one of the key aims and if you don't meet the aims then you can't pass in a subject," said principal Ann-Charlotte Brandberg on the programme.
According to the prinicpal, pupils are not allowed to make insulting comments about their class-mates or other people.
"We have freedom of speech and we're careful about applying it. But we are also careful about how we treat others."
Ingegärd Hillborn, senior lawyer at the National Agency for Education, finds the school's actions dubious.
"If the teacher has taught about democracy and its principles and the pupil shows he or she has understood the subject, but then says 'I think dictatorship would be a better style of government', the pupil has knowledge on the principles of democracy but is of a different opinion. In such a case, it's the knowledge which should be taken into account when deciding the grade," said Hillborn.
Ytterby school has about 670 pupils and has experienced problems with nazism and racism. This decision was recently taken at a parents meeting. The school was then reported to the justice ombudsman by the regional Liberal Youth Association.
School minister, Ibrahim Baylan, refused to comment on the case. However, his party colleague and member of parliament, Luciano Astudillo, said the move by the school contravened freedom of speech.
The Liberals' education spokesman, Jan Björklund, thinks it's unacceptable to lower a knowledge-related grade for holding certain views.
He highlighted instead his party's proposal to have a grade for good behaviour as a way the school can influence anti-social attitudes.
"Schools must be able to send a message to pupils who don't treat others with respect. That's why there's a need for a new grade for behaviour," he said in a press release.
Metta Fjelkner, chairwoman of the teachers' association, had similar criticisms and underlined that it was not allowed to incorporate behaviour into a grade for a subject.
"Teachers should obviously try to combat [racist] tendencies and they can do so in various ways. However, it's wrong to punish pupils for having the wrong views or abusing others," she said.