Night after night, the candidates for D.C. mayor sit side by side in forums before every manner of interest and ethnic group — architects, Latinos, black entrepreneurs, Baptist ministers, ex-prisoners. For the most part, race goes unmentioned — and that, many voters say, is a welcome sign of progress in a long-divided city.

Yet race could determine the outcome of the April 1 Democratic primary, which is usually tantamount to election in a city that has never had a mayor of any other party. Rapid and dramatic demographic change has stripped Washington’s African American population of majority status for the first time since 1957, making this year’s election the best test yet of how the conflicting forces of gentrification and the historic legacy of the civil rights movement will reshape power and politics in the nation’s capital.

With more than 80,000 new voters registered since 2010 among the District’s 445,000 voters, candidates are eager to learn whether the city’s mostly young newcomers are less wedded than longtime residents to the idea that the city ought to have a black mayor. Does the city’s shifting population justify fears of “The Plan,” the long-harbored suspicion among many black voters that whites would eventually take back the reins of power? Will new voters prove to be less race-conscious than their elders?

“The identity of the city since the ’60s has been ‘Chocolate City,’ ” said George Derek Musgrove, a historian at the University of Maryland Baltimore County who lives in Washington and is writing a book on race and politics in the District. “The last thing keeping that identity intact is the mayoralty.”

Four years ago, with the city’s population shift already well underway, voters cleaved along racial lines. In overwhelmingly white Ward 3 in Upper Northwest, then-mayor Adrian M. Fenty, who is biracial, took 80 percent of the vote, while in almost entirely black Wards 7 and 8, east of the Anacostia River, challenger Vincent C. Gray, who is black, won 82 percent support.

The issue was not the racial lineage of the candidates so much as a perception, at least among voters, that the two politicians held vastly different views about blacks’ and whites’ concerns: As Fenty touted his success in building bike lanes and dog parks and purging schools of incompetent teachers, Gray promised to rehire many fired teachers and slammed the mayor for wasting tax dollars on fancy amenities valued by affluent newcomers.

This year’s electorate seems similarly divided. In a WRC-WAMU poll released late last month, Gray leads among black voters with 41 percent support, but he lands in fourth place with only 10 percent support among whites. Two white candidates, D.C. Council members Tommy Wells (Ward 6) and Jack Evans (Ward 2), lead among white voters, with 24 percent and 21 percent, respectively. And David A. Catania (I-At Large), a former Republican who is white and gay, looms as a strong challenger to Gray in the fall should the mayor prevail in the primary; a Washington Post poll in January gave the mayor a statistically insignificant lead over Catania in a theoretical November faceoff.

With less than a month before the primary, Gray’s campaign is touting a video it calls “One of Our Own,” a half-minute spot in which the mayor talks about being a native Washingtonian while he is seen with seven residents, all of them black. In another ad, about education, the Gray campaign shows 21 residents, 17 of whom appear to be black.

Gray’s campaign manager, Chuck Thies, said the ads carry no racial message. “ ‘One of Our Own’ means any District resident, whether you moved here yesterday or you’ve lived here for 80 years,” he said.

Thies said his research shows that new residents are not inclined to vote in local elections for some years, leaving longtime residents as the core D.C. electorate. And among that group, “there are many people, black and white, who feel that this city is and should remain Chocolate City because of its traditions and culture,” he said. “They are choosing candidates not because of the color of their skin, but because of that rich history and culture.”

On the campaign trail, Wells now questions whether Evans, who frequently praises Gray’s management of the city, is running to dilute the white vote and ease the mayor’s reelection. “Jack is an apologist and advocate for the mayor,” Wells said. “I don’t know why he’s in the race. I don’t know if he’s in it to block me.”

Wells’s campaign manager, Chebon Marshall, is blunter: “You’re either running against the mayor or you’re a well-funded Sulaimon Brown,” he said, referring to the also-ran candidate whose attacks on Fenty were secretly financed by Gray’s 2010 campaign — part of a campaign-finance scandal in which four top Gray campaign aides have been convicted of felonies.

Evans, for his part, said he’s in the race to win. “There’s a different dynamic in the city than there was in 1998,” when he last ran for mayor, he said. “A white guy is mayor of Detroit now. People are tired, especially east of the [Anacostia] river, of electing people and nothing ever changing. They just want to know, can you bring the prosperity across the river?”

Black majority takes root

Beneath the rhetoric of a hard-fought campaign lies a historic shift in the city’s population and economics, challenging the traditional assumption that Washington would or should be black-run.

Washington has always had a large black population, but in the middle of the 20th century, it became the first major U.S. city with a strong black majority, as many whites fled to the suburbs and many blacks moved here from the South in search of jobs in the rapidly expanding federal government. That majority, which emerged in 1957, reached a peak of 71 percent in the 1970 Census and lasted 56 years. In the past two years, census data indicate, the black population has slipped below 50 percent.

That doesn’t mean the District is anywhere near a white voting majority; older voters enjoy an outsize role in local elections because many new arrivals retain psychic ties to other places.

“Some of them are still registered back home,” said council member and mayoral candidate Muriel Bowser (Ward 4.) “And some are registered here but only to vote for [possible presidential candidate] Hillary [Clinton], not in local elections. The civil rights generation are still the most active and reliable voters.”

But Musgrove, the historian, argues that civil rights movement veterans who dominated D.C. politics in the first decades of home rule — such as four-term mayor Marion Barry and council chairmen John Wilson and Dave Clarke — have already passed from power.

“The passing of the civil rights-home rule generation brought us the children of that generation, including [former council members] Kwame Brown, Michael Brown and Tommy Thomas,” Musgrove said, and those sons of prominent civil rights-era political figures in the city, now disgraced former council members, “were miserable — and not just because they were caught stealing, but because they never had a vision for the city.”

Now, the historian sees a new, younger group taking power, including council members Kenyan R. McDuffie (Ward 5) and David Grosso (At Large), who focus more on retaining economic diversity than on racial identity. Young voters, too, “have very different notions of politics and race than the older generations did,” Musgrove said. “Young black professionals are willing to give Tommy Wells a fair shake.”

Many young voters say issues of class and affordability now trump strictly racial concerns.

Nicole Goines, a 20-year-old native of Brentwood in Ward 5 who is black, said she’s volunteering for Wells because “we need to get out of the mind-set that only a black mayor can help black Washington. I need D.C., my town, to keep up with the times. You don’t see other cities debating whether they should have a black mayor. The term ‘Chocolate City’ needs to be thrown out of the city.”

After four years in Washington, Andrew Powaleny, a 26-year-old who works in corporate communications and is white, said he has concluded that D.C. voters no longer base voting decisions on color. “I can’t imagine that race would play a role,” he said. “I like Bowser because she understands the need to foster growth to create jobs, not because of her race.”

Legacy of civil rights era

But just as the election of a black president doesn’t ensure that American society has entered some post-racial utopia, the end of a half-century of majority status for blacks in Washington doesn’t automatically erase the expectation that African Americans will play a central role in governing the city.

That’s a view whites and blacks have shared for decades. In 1987, Washington Post columnist Dorothy Gilliam wrote that “the big fear of many blacks . . . , an unconscious terror born of years of political impotence” was that whites would move in and “take the city back.”

Washington Post polls since the 1990s have shown that many residents believe it is important that the District have a black mayor. The percentage of people saying that is important declined from 52 percent in 1998 to 45 percent in 2012, and although blacks are more likely to take that view, more than one in three whites agreed in 2012.

“It’s progressives in general who feel that this was and should still be Chocolate City,” said Rick Rosendall, longtime leader of the Gay and Lesbian Activists Alliance. “That’s the legacy of the civil rights movement in the city.”

As former mayor Anthony A. Williams has put it, “Cities have a certain background, and that culture permeates, even long after that group is no longer the majority.”

D.C. campaigns routinely examine one another’s focus on race. Evans has sent out mailers in which nearly every face pictured other than his own is black. Wells offers reporters the names of black ministers who support him.

For many black Washingtonians, the convictions of three D.C. Council members in the past two years has served as “a reminder that just because somebody’s black doesn’t mean they’re going to be good for the city,” said Graylin Presbury, president of the Fairlawn Citizens Association in Southeast. But Presbury, a 58-year-old federal worker, said he doesn’t think a white candidate can win the mayoralty “for another 10 or 12 years, because even though we live in changing times, we still have a lot of people who look at every new development and say, ‘That ain’t for us.’ They’re going to want one of their own in charge.”

Some whites still struggle with the idea that the District ought to be black-run. “Under the right circumstances, I’d vote for a white candidate, and a lot of black folks would, too,” said Mike Silverstein, who is white and a longtime advisory neighborhood commissioner in Dupont Circle. “But whether they’ve been here a long time or just came in, folks of all races understand the history and sociology of the city and are respectful of that.”

But some voters say electing a mayor of a different race for the first time since home rule began in 1973 would be a sign of progress. Choosing a mayor “not just because he’s black will be another step forward, not just symbolically but substantively,” said Laurel Reiner, a social worker who is white and supports the candidacy of Andy Shallal, the owner of the Busboys and Poets restaurant chain. “After this election, we’ll know if the city has really changed.”

Shallal, an Iraqi American who describes himself as “not white, not black, but a bridge,” sees his opponents making direct racial appeals, raising “a real danger” that in a field of candidates this large, “you can actually win with support from just one segment of the community.”

At a forum at Arena Stage in Southwest that attracted a mixed crowd, Shallal responded to a question about whether a white person could be elected mayor by reciting Langston Hughes’s poem “Let America Be America Again:” “I am the poor white, fooled and pushed apart / I am the Negro bearing slavery’s scars . . . And finding only the same old stupid plan / Of dog eat dog, of mighty crush the weak.” He won cheers from the audience and applause from his opponents.

Scott Clement contributed to this report.