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

An Alabama federal judge has given a mostly white town the green light to secede from the racially mixed county school district and start its own system — even though "race was the motivating factor" for many supporters of the split.

But in her ruling, Judge Madeline Haikala also reserved the right to reverse her decision if the city of Gardendale reverts back to its segregated past.

Among other things, Haikala has ordered that an African-American be appointed to the all-white school board within 60 days.

“History teaches that communities, left to their own devices, re-segregate fairly quickly,” Haikala wrote in her 190-page ruling.

A suburb of Birmingham with a population of 14,000, Gardendale is 88 percent white. It is located in Jefferson County, which had a population of 658,000 that is roughly 53 percent white and 42 percent black.

Haikala’s ruling, which came down on Monday, apparently caught the Gardendale School Board by surprise.

In a statement, board president Chris Segroves said they were reviewing the order and leaning on their lawyers for “advice as to the best methods for us to move forward in the creation of the Gardendale City School System.”

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

And on May 16, Haikala’s ruling is expected to be the hot topic when the Board of Education meets and the public gets the chance to question board members.

Monique Lin-Luse, a lawyer with the NAACP Legal Defense and Education Fund who represented black families opposed to the split, said she applauded Haikala’s clear statement that race was at the root of the separation movement. But she remains perplexed by the judge’s ultimate decision and said she is weighing whether to appeal the decision.

"It is difficult to square that with the final result, which doesn't give (Gardendale) a free pass to operate," Lin-Luse said. "It was not the outcome that, frankly, any of the parties expected."

Gardendale has for many years sought to create its own school system and city leaders spelled out their reasons on the Board of Education's web site.

Posters for the football and cheerleading squads hang at Bragg Middle School in Gardendale, Alabama, in August 2016. Linda Davidson / The Washington Post/Getty Images file

"We believe that having local control over the city’s schools will give the community a sense of pride and ownership," it says. "Research has demonstrated that schools benefit from being in a community that is directly invested in their success. From an economic standpoint, forming a city school system in Gardendale should allow us to flourish."

Haikala in her ruling wrote that after reviewing the social media postings of split supporters — and Jefferson County's long history of school segregation — she is convinced darker forces were behind the push.

“Race was a motivating factor in Gardendale’s decision to separate from the Jefferson County public school system,” the judge wrote. “The record demonstrates that some Gardendale citizens are concerned because the racial demographics in Gardendale are shifting, and they worry that Gardendale, like its neighbor Center Point, may become a predominantly black city. These citizens prefer a predominantly white city.”

They believe a separate school system “will help reduce white flight,” wrote Haikala, an Obama Administration appointee who recounted in her ruling the decades-long battle over school de-segregation in Jefferson County.

Pointedly, Haikala also slapped the Gardendale school board for not standing up to the racists.

“No member of the board has disavowed the belittling language of exclusion used by separation organizers and supporters,” the judge wrote. “The silence is deafening.”

Board member Dr. Michael Hogue and Supt. of Schools Dr. Patric Martin discuss school board business during a Gardendale City Board of Education meeting on Aug. 3. Linda Davidson / The Washington Post/Getty Images

But in the end, Haikala ruled in favor of separation because she fears students from mostly black North Smithfield who get bused to Gardendale schools would get “the blame” if she didn’t.

“Students from North Smithfield may feel unwelcome in Gardendale schools,” she wrote.

Haikala also wrote that she wanted to be fair to the parents in Gardendale “who support a municipal separation for reasons that have nothing to do with race.”

“All parents want the best possible education for their children, and there is nothing inherently wrong with preferring a small local district to a large county district,” she wrote.