Benjamin Banneker Academic High School in Northwest Washington, shown last week. (Perry Stein/The Washington Post)

The future of a vacant school that has emerged as a symbolic battleground over the direction of the District’s public education system was settled Tuesday after two hours of fiery debate among D.C. Council members.

By a 7-to-6 vote, the council chose to move Benjamin Banneker Academic High — a top-performing application high school that serves mostly black and Hispanic students — to the site of Shaw Junior High School, which was closed a decade ago amid declining enrollment.

The vote represented a win for Mayor Muriel E. Bowser (D), who couched the vote as the latest gentrification fight in the city, further pitting longtime residents who send their children to Banneker against more-recent arrivals in the city’s Shaw neighborhood. The mayor had pushed to move Banneker to the more expansive site in Shaw, allowing the high school’s enrollment to increase by 300 students.

Banneker has been in the 800 block of Euclid Street NW since opening in 1981. The site approved by the council Tuesday sits a mile south, in the 900 block of Rhode Island Avenue NW.

“The primary tool for coming out of poverty is education,” council member Robert C. White Jr. (D-At Large) said as he explained why he was voting to move Banneker to the Shaw site. “We should not limit the growth capacity at Banneker.”

The move upset scores of residents in Shaw, a gentrified area experiencing a baby boom. They had hoped the site would be used to resurrect a stand-alone middle school in the heart of their neighborhood. Supporters of using the Shaw site for a middle school said the city should invest in neighborhood schools instead of expanding Banneker’s capacity, a move that could draw more students away from those schools.

“We are at a pivotal point in our school system,” said council member Elissa Silverman (I-At Large), who supported renovating Banneker at its current site. “If we do not invest in our neighborhood schools, then we are going to go to a system that’s just all about chance in our city. That’s part of what this debate is about.”

The debate Tuesday unfolded as the D.C. Council took its final vote on the city’s $15.5 billion budget. As part of her initial budget, Bowser proposed more than $140 million to relocate Banneker to the Shaw site.

But this month, the council’s chairman, Phil Mendelson (D), proposed renovating Banneker on its existing campus, which would have paved the way for a new middle school on the Shaw grounds.

Last week in an initial vote, seven council members — a majority — supported Mendelson’s plan.

But council member Vincent C. Gray (D-Ward 7) switched his stance Tuesday, a pivotal shift in favor of moving Banneker to the Shaw site. He said he believes the high school and middle school could exist in separate buildings on the Shaw property. Council member David Grosso (I-At Large), who chairs the Education Committee, said that was a possibility.

“Moving Banneker does not preclude or prevent there from being a middle school in the area or even the site,” Grosso said.

After losing the vote to keep Banneker at its current site, council member Charles Allen (D-Ward 6) proposed another idea: Once Banneker moves, that site should be used for the stand-alone middle school.

Allen’s proposal passed but did not include money to renovate the building for a middle school. But there is funding to start the planning process for a stand-alone Shaw middle school.

Shaw families can now send their children to middle school at the Cardozo Education Campus, which serves middle and high school students.

“What guided me is that there has been a longtime promise to the Shaw community to build a middle school,” Allen said.

The vote Tuesday capped months of debate over the future of the Shaw site. Banneker students and Shaw families have flooded city hall, protesting and lobbying council members.

On Tuesday, the two communities sat on opposite sides of the council room, briefly cheering when something seemed to go their way on the council dais.

Banneker students said in interviews that their building is decrepit and that even with a renovation it would not have the space for athletic fields they want. Some said they view their admittance to Banneker as a ticket to a better life and want that opportunity extended to more students.

“The fact is that Banneker gives you hope that you can be something greater than what you learned in your community,” Mya Patterson, a junior at the school, said in an interview last week. “Expanding Banneker and relocating it will give more students the chance to feel the same way I do.”

They argued that Banneker is already a top-performing school and could accomplish more on a bigger and modernized campus.

“Across the nation, our inner cities are at a disadvantage and at a need for development in black or brown communities,” junior RuQuan Brown said. “And it’s almost like a slap in the face when here is an opportunity for us to continue to grow.”

“Just imagine how our greatness will be multiplied with this space,” Brown said.

Shaw families — and council members who supported their vision of a stand-alone middle school — said it is disingenuous to frame the debate over Banneker as a gentrification battle. While Shaw has gentrified, the majority of students at the five elementary schools in the neighborhood are black and Hispanic.

The families said every neighborhood should have a quality school at all grade levels.

Becky Reina, a Shaw resident with two children, said she is glad that Allen’s measure to build a stand-alone middle school at the Banneker site passed, even if it was not the ideal location.

“Now, Shaw Middle School can eventually exist,” she said. “I’m excited the city did something today to strengthen the feeder pattern in the neighborhood.”

Council member Kenyan R. McDuffie (D-Ward 5), who supported Banneker’s move to the Shaw site, said in an interview that this was an important vote but that it should not have pitted two communities against each other.

“The stakes are high and should remain high,” he said. “But the complexity of the issue should not have been reduced to the binary choice between whether you support black or brown kids or a gentrifying neighborhood of Shaw.”