Barnette v. West Virginia Board of Education (1943)
In 1943, the US Supreme Court overturned the ruling it had made three years previously in another flag salute case involving Jehovah's Witness students, Minersville v. Gobitis.  By a vote of 6-3 the court in Barnette v. W.Va. Board of Education came down on the side of students who had been expelled from school for refusing to salute the flag. 

The students had brought a challenge to a compulsory flag salute required by the West Virginia Board of Education, which stated that failure to conform was "insubordination" which should be dealt with by expulsion.  Not only were expelled children to be regarded as "unlawfully absent" and hence potential delinquents.  Their parents were liable to prosecution, fines and jail terms.      

While the students' case had been presented as a matter of religious liberty, the majority Supreme Court opinion written by Justice Robert Jackson in the Barnette case was a ringing endorsement of the right to freedom of thought and expression, even in the middle of a war.  The decision states that "the very purpose of a Bill of Rights was to withdraw certain subjects from the vicissitudes of political controversy, to place them beyond the reach of majorities and officials and to establish them as legal principles to be applied by the courts."  In other words, it was not up to legislatures or popular opinion to decide whether or not to uphold fundamental rights.  The opinion examines whether "compulsion" is a permissible means to achieve "uniformity of sentiment" and "national unity" and points out where that may lead: "Those who begin coercive elimination of dissent soon find themselves exterminating dissenters.  Compulsory unification of opinion achieves only the unanimity of the graveyard....We set up government by consent of the governed, and the Bill of Rights denies those in power any legal opportunity to coerce that consent." 

With these stirring words the decision enshrines the right to dissent:  "If there is any fixed star in our constitutional constellation, it is that no official, high or petty, can prescribe what shall be orthodox in politics, nationalism, religion, or other matters of opinion or force citizens to confess by word or act their faith therein...We think the action of local authorities in compelling the flag salute and pledge transcends the constitutional limitations on their power and invades the sphere of intellect and spirit which it is the purpose of the First Amendment to our Constitution to reserve from all official control..." 

This ruling for the first time recognizes that the Bill of Rights applies to students in public schools.  Students cannot be forced to participate in the Pledge of Allegiance, and cannot be punished for refusing to salute the flag.

http://www.oyez.org/cases/1940-1949/1942/1942_591/