About 250 pupils walked out of a Pembrokeshire school to protest against a teenager being removed from lessons after shaving his head for charity.
Rhys Johnson, 14, raised cash for cancer research after a third relative was diagnosed with the disease.
But he ended up being taught in isolation at Milford Haven School after it said he broke its haircut rules.
The school said Rhys could return to normal lessons on Monday but it was disappointed by Friday's demonstration.
Rhys and a friend, 14, had their heads shaved as part of the annual UK-wide Macmillan Coffee Morning on Saturday and raised about £700.
But the Milford Haven School policy on hairstyles says "no shaven heads" so he was told he was not allowed to return to his normal classes, instead doing "supervised study" at school.
At the time, Rhys's mother Lucy O'Neill said he was being "punished" for trying to do some good.
She added that his friend had encountered no such problems at her school, nearby Tasker Milward.
She said that Rhys's school had telephoned to warn her about its policy on hair cut too short but by that stage her son had already collected a lot of his sponsorship money.
"So he said 'I've got to do this mam'," she said.
The school said in a statement on Friday: "The pupil in question and his mother were informed of the consequences of breaking the uniform and appearance rules prior to doing so.
"When the rules were broken an appropriate sanction was enforced, namely supervised study.
"This was a short-term measure which was clearly communicated and a return to the pupil's normal timetable would have been effective once he complied with the school's ruling.
"At Milford Haven School we believe it is important to maintain high standards in every aspect of school life, including uniform and appearance."
The statement added: "While this morning's demonstration by some pupils was disappointing and ill-advised, lessons for the vast majority of pupils continued as normal."
Pembrokeshire Council said it was confident that the "vast majority of parents will support the school in its efforts to raise academic standards and implement school rules".
The council has also addressed the issue of why Rhys's friend was treated differently at her school, saying: "Each school governing body formulates its own policy on its uniform code and has its own expectations regarding compliance."
Sean Griffiths, who knows some of the protesting pupils through his dance school, said the students believed the situation had been unfair.
"I can understand the school doesn't want kids coming through with different hairstyles. But this was done for a really good reason and I think the kids have recognised that," he said.
A spokesperson for Macmillan in Wales said: "Macmillan cannot comment on individual school policies but we are extremely grateful to our fundraisers as the vital money they raise helps us to support people affected by cancer throughout Wales.
"Money raised by World's Biggest Coffee Morning helped us to spend £3.2m on our services in Wales in 2012 including our information and support centres, our nurses and our welfare benefits advisers."