Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

More than 20 students at a southwestern Virginia high school were suspended Thursday after wearing clothing bearing the Confederate flag in protest of school policy.

Twenty-four students arrived at Christiansburg High School Thursday morning wearing the Confederate flag, which is against the school dress code, Montgomery County Public Schools Spokeswoman Brenda Drake told NBC News.

Drake said the school has a general policy against offensive attire. Several incidents of "racially motivated behavior" back in 2001 and 2002, specifically related to the Confederate flag, led for the symbol to be banned, she said.

The high school implemented a new policy this year preventing students from displaying the flag or decals with the Confederate iconography on their cars if they wished to park in the school parking lot. Students must agree in a contract to not display the flag before receiving a school parking pass.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Some students said they wore the flags in protest of the bans.

"They’re trying to get rid of it, and they’re not trying to get rid of any other flags," student Forrest Taylor told NBC affiliate WSLS. "They say that it’s a racist thing even though it’s not."

"It’s not racist, I can tell you that right now." Hannah Smith, another student, said.

The student protesters were asked to comply with the school dress code upon entering the school, but 21 of the 24 refused, Drake said.

Those who did not comply were given one-day in-school suspensions, the standard procedure for this type of infraction, she said.

Some of those students began to disrupt the school environment with "loud displays and behavior," Drake said, and 15 were then issued a one-day out of school suspension. Two additional students received a three-day suspension for "threatening and abusive language," she said.

Drake said that while the school system values students’ First Amendment rights, "we must maintain an orderly and safe environment for all students." The school has about 1,000 students.

Drake said the school didn't ban the flag to make a statement about its symbolism, but rather to ease tensions. Recent incidents over the symbol prompted the parking lot ban, she said.

"We are not issuing a judgment on the flag, but know that not allowing it at CHS supports a peaceful educational environment in the building," said Drake. "Continued racial friction suggests that lifting the ban of this particular symbol would cause significant disruption at the school."