An appeals court said that a Morgan Hill, Calif. school did the right thing by banning children from wearing T-shirts with the American flag on it during Cinco De Mayo. The court said that the school was hoping to keep the students safe in a tense racial environment.

The case goes back to May 5, 2010 when a group of Live Oak High School students were asked by their principal to take off their U.S. flag shirts or turn them inside out, reports CNN. The students refused and sued the school, claiming that officials violated their freedom of expression, equal protection and right to due process.

In their opinion, the judges of the 9th Circuit Court of Appeals had to weigh the importance of free speech over safety concerns. Ultimately, though, the judges ruled in favor of the school. “The controversy and tension remained but the school's actions presciently avoided an altercation,” they wrote.

The Washington Post notes that the court referred to the 1969 Supreme Court decision Tinker v. Des Moines Indep. Comm. School Dist., which did rule that students’ rights are limited if officials believe that their actions will cause a disturbance in the school.

In fact, court documents note that an incident did happen in 2009 at the school on Cinco De Mayo, as students with a Mexican flag had an altercation with students who put up a U.S. flag.