(CNN) A predominantly white Alabama city cannot secede from a county school system that remains under a 1971 desegregation order, a federal appellate court ruled, citing racially driven Facebook posts as one factor in its decision.

Gardendale, Alabama, won a partial victory last summer when a federal judge ruled that, despite evidence that secession backers were motivated by changing racial demographics, the city could operate two elementary schools.

On Tuesday, a three-judge panel of the US 11th Circuit Court of Appeals sent the case back to the district court with instructions to "deny the motion to secede." Presently, Gardendale is part of the school system in Jefferson County, whose county seat is Birmingham.

"We conclude that the district court committed no clear error in its findings of a discriminatory purpose and of impeding the desegregation of the Jefferson County Schools, but that it abused its discretion when it ... allowed a partial secession," the ruling stated.

The Gardendale Board of Education, which was formed in 2014 as part of the city's effort to form its own school district, released a statement saying it was "deeply grieved" by the decision and that it intended only to create a "new, welcoming, and inclusive school system."

"We know the heart and intent of this board and of the residents of Gardendale as a welcoming community, and we believe our actions reflect just that," the statement said. "This is not the result we deserve, and the fight is not over."

'Something totally different'

The school board said it felt the judges had misunderstood the evidence and misapplied the law.

"A decision that blames Gardendale for the comments of private citizens on social media is both contrary to the Constitution and a fundamental miscarriage of justice -- and it is one we will continue to appeal," the statement said.

School demographics, 2015-16 Snow Rogers Elementary 85% white 5% black Gardendale Elementary 71% white 24% black Bragg Middle School 67% white 29% black Gardendale High 71% white 27% black Source: US Court of Appeals for the 11th Circuit

But Judge William Pryor, who wrote the panel's decision, said the intent of the social media posts was clear, and the authors of some of those posts were not merely private citizens, but "secession leaders" who would later serve in official capacities for the school board, two serving on the board itself and two serving on an advisory board.

Jefferson County Schools, according to the court, were 43% white and 47% black in 2015, which roughly reflects the county's population. Gardendale is about 13% black, according to census data, and the court said three of the four schools in the city are at least 24% black.

The court felt that was the driving factor behind a would-be advisory board member's Facebook post stating, "A look around at our community sporting events, our churches are great snapshots of our community. A look into our schools, and you'll see something totally different."

While other posts made in the school district's Facebook group spoke of the importance of autonomy, diminishing class sizes, improving test scores and the need "to control (its) own revenue stream," the court found secession leaders never discussed these concerns with the county, "and they struggled to identify specific deficiencies in the County schools."

'There's your redistribution of wealth'

There were also frequent complaints about nonresident students, especially those from the predominantly black North Smithfield community, increasing at "an alarming rate" without contributing financially, the court pointed out.

"We are using buses to transport non-residents into our schools (without additional funding) from as far away as Center Point (there's your redistribution of wealth)," the would-be advisory board member said, later adding that Gardendale didn't "want to become" Center Point, a town that was 99% white 48 years ago but is now about 33% white.

Photos: Freedom Rides challenge segregation in Deep South Photos: Freedom Rides challenge segregation in Deep South Civil rights activists known as Freedom Riders sit at a bus station in Birmingham, Alabama, in May 1961. That month, the Freedom Ride movement began with interstate buses driving into the Deep South to challenge segregation that persisted despite recent Supreme Court rulings. In some cities, the activists were arrested and brutally beaten. Hide Caption 1 of 13 Photos: Freedom Rides challenge segregation in Deep South Two leaders of the civil rights movement -- the Rev. Ralph Abernathy, left, and the Rev. Martin Luther King Jr. -- wait for news about Freedom Riders. There were at least 60 Freedom Rides from May until December of 1961. Hide Caption 2 of 13 Photos: Freedom Rides challenge segregation in Deep South A white man in Anniston, Alabama, sits in front of a bus to prevent it from leaving the station with a load of Freedom Riders on May 15, 1961. Hide Caption 3 of 13 Photos: Freedom Rides challenge segregation in Deep South Freedom Riders sit outside a bus after it was set on fire by a white mob in Anniston on May 14, 1961. Hide Caption 4 of 13 Photos: Freedom Rides challenge segregation in Deep South National Guardsmen and U.S. marshals from Mississippi are seen through a bus window as Freedom Riders travel from Montgomery, Alabama, to Jackson, Mississippi. Hide Caption 5 of 13 Photos: Freedom Rides challenge segregation in Deep South A group of Freedom Riders from Nashville, Tennessee, are arrested after arriving in Birmingham. Bull Connor, the Birmingham police commissioner, said the group was being arrested for its own protection. Hide Caption 6 of 13 Photos: Freedom Rides challenge segregation in Deep South John Lewis, left, and James Zwerg stand together after being attacked and beaten by segregationists in Montgomery, Alabama, on May 20, 1961. Lewis is now a U.S. congressman from Georgia. Zwerg tells the story behind the photo Hide Caption 7 of 13 Photos: Freedom Rides challenge segregation in Deep South Freedom Riders endure tear gas that was thrown into Abernathy's church in Montgomery on May 21, 1961. Hide Caption 8 of 13 Photos: Freedom Rides challenge segregation in Deep South The National Guard takes people to safety after Abernathy's church was hit with tear gas bombs. Hide Caption 9 of 13 Photos: Freedom Rides challenge segregation in Deep South Lewis, with his head bandaged, relaxes with fellow Freedom Riders at a safe house in Montgomery. Hide Caption 10 of 13 Photos: Freedom Rides challenge segregation in Deep South In addition to segregation on buses and trains, there were also segregated waiting rooms at transit stations. Hide Caption 11 of 13 Photos: Freedom Rides challenge segregation in Deep South Freedom Riders look out from bus windows during a stop. Hide Caption 12 of 13 Photos: Freedom Rides challenge segregation in Deep South A Freedom Rider and a National Guardsman sleep on a bus ride from Selma, Alabama, to Montgomery. Hide Caption 13 of 13

FOCUS Gardendale, which was formed to promote a city school system, distributed a flier featuring a white student and asking, "Which path will Gardendale choose?" The flier listed several predominantly black and predominantly white towns, calling the latter "some of the best places to live in the country," the court said.

Though the plaintiffs insisted the Facebook comments were irrelevant, the appeals court ruled "the comments shed light on the motivations behind the creation and later actions of the Gardendale Board."

"Most of the Facebook posts cited by the district court were made by the secession leaders who spearheaded the movement," the ruling said. "The secession leaders were able to delete posts, approve or reject individuals who sought to join the page, block individuals who were previously approved to post on the page, and change the privacy settings of the page."

The appeals court concurred with the district court, which found, "The Gardendale Board not only failed to disavow those messages of inferiority but instead reinforced them."

The original order

The fight stems from a 1971 US District Court desegregation order for Jefferson County, which is still in effect.

"The 1971 order established school attendance zones, including the Gardendale attendance zone, and comprehensive policies for student assignments, school construction, and the transfer of students between attendance zones," Tuesday's court ruling said.

Pleasant Grove, just west of Birmingham, refused to comply with the order at the time, and a federal court placed the city's schools under Jefferson County control, the appeals court noted. Vestavia Hills, Homewood and Midfield attempted to form their own school systems, but a federal court ordered Jefferson County not to recognize them if their creations "have the effect of thwarting the implementation of a unitary school system."

The US Supreme Court ruled the following year in a Virginia case, "A new school district may not be created where its effect would be to impede the process of dismantling a dual system."

JUST WATCHED What in the World: Segregation in 2016? Replay More Videos ... MUST WATCH What in the World: Segregation in 2016? 04:01

Gardendale's secession movement, the court alleged, began only when its schools became "racially diverse while the population of the City remained overwhelmingly white." That diversity is a product of residents from more integrated towns outside the city attending Gardendale's schools, including black students who take advantage of majority-to-minority programs that bus them into the district, according to the court.

"Gardendale schools are racially diverse institutions in an otherwise white enclave in large part because zoning and desegregation transfer opportunities permit other Jefferson County students to attend the schools," the appeals court said.

The Gardendale City Council adopted an ordinance in 2014 to establish a public school system and school board, but "although the Council received applications from black residents of Gardendale, the five members selected were all white," the court said.

A draft plan for the schools that was never officially approved said "racial desegregation transfer students" could attend Gardendale's schools, contingent on students finding their own transportation, space availability, annual reapplications and "tuition payments by means other than personal check," according to the appeals court.

An advisory board member took to Facebook to say of the provision, "You and I may not think that it is particularly fair to accept an out-of-district area not subject to our control or taxation as a price to pay to gain approval for separation, and we would be within reason to feel that way. The extent to which fair has anything to do with it depends on how you weigh your priorities in deciding whether it is too bitter a pill to swallow or if the ultimate treatment goal, i.e. separation, is worth it."

JUST WATCHED 2015 report: U.S. segregation hurting youth Replay More Videos ... MUST WATCH 2015 report: U.S. segregation hurting youth 03:22

The Facebook group is now closed and not accepting new members

"I am considering putting this page into archived status. I actually did archive it but had to undo that to modify the group statement," reads the group's "about" section. "NO comments here represent the Gardendale City School system or the Gardendale Board of Education."

Despite the disclaimer, posts to the Facebook group served as evidence to both the district and appeals court that secession leaders "prefer a predominantly white city," the court said.

"Most of the transfer students attending the Gardendale schools were desegregation transfer students. So the children 'who look totally different' from the children who attend churches in Gardendale or play on ball fields there are students from the North Smithfield community . . . and transfer students from areas like Center Point who attend Gardendale schools pursuant to the . . . desegregation order," the appeals court said, citing the lower court.