The nation’s two most prominent rising black political stars — vying to make history in Georgia’s and Florida’s gubernatorial races — appeared to both fall short Tuesday night in disheartening losses for Democrats and minority activists.

Tallahassee Mayor Andrew Gillum was defeated in his bid to become the first African American governor of Florida, with election results showing him barely outedged by Republican former congressman Ron DeSantis.

In Georgia, former state legislator Stacey Abrams — attempting to become the country’s first black female governor — trailed in the late-night election tally against Republican Secretary of State Brian Kemp.

On a night when black and minority candidates had been poised to break long-standing barriers, the disappointments came despite massive fundraising efforts, national attention and a parade of black leaders and celebrities stumping on their behalf.

The Gillum and Abrams races also drew blatant racial attacks rarely seen since the Civil Rights era of the 1960s. And GOP officials in several states, including Georgia, tried to impose restrictions on voters that some voting rights advocates said harked back to suppression tactics against blacks in the Jim Crow South.

Other minority candidates, however, did claim historic outcomes.

Sharice Davids in Kansas and Debra Haaland in New Mexico both won their bids to become the first Native American female members of Congress. Minnesota’s Ilhan Omar and Michigan’s Rashida Tlaib will head to Washington as the first Muslim women in Congress.

And in Colorado, Jared Polis became the first openly gay man voted in as governor.

The unprecedented racial, gender and religious diversity of Tuesday’s candidates at federal and state levels provided a rare chance to test exactly how far long-standing barriers could be pushed — particularly during a midterm deeply influenced by President Trump’s rhetoric tapping into resentments between whites and minorities.

Gillum held his election-night party on the lawn at Florida A&M University, his alma mater. The crowd waited through a thunderstorm and heavy rain and remained festive as early results came in. But the numbers never turned definitively in his favor.

Shortly after 11 p.m., many clutched their arms over their hearts as the 39-year-old Gillum choked up during his concession speech. “I sincerely regret that I couldn’t bring it home for you,” he told them.

From the back, a woman started yelling, “You brought it home! You brought it home!”

Issues of race permeated contests across the board, heightened in recent weeks by Trump. He hyped the dangers of a migrant caravan headed for the United States by calling it an “invasion.” He proposed revoking birthright citizenship, and his campaign released an ad that major television networks eventually deemed too racist to air.

By running on racially tinged messages, Republicans in some ways put those explosive tactics on the ballot. Some activists feared the outcome of Tuesday’s vote would be seen especially by Republicans as a validation of such blunt attacks.

“We know that racism divides people, but we have also seen that racial justice also unites and motivates people,” said Rashad Robinson, president of the racial justice group Color of Change. “This is not a matter of Trump’s frame being the more compelling one. It’s about his platform being the larger one.”

Supporters of Abrams remained upbeat late into the night, clinging to the possibility the race could still turn in her favor. Shortly after midnight, the chants began among those gathered at the Hyatt Regency in downtown Atlanta:

“Sta-cey!”

“A-brams!”

In a speech around 1:40 a.m., their candidate did not concede the race but instead signaled Georgians that they might have a chance to vote for her again in a possible runoff.

“If I wasn’t your first choice, or if you didn’t make a choice at all, you’re going to have a chance to do a do-over,” said Abrams, referencing the attacks on minority voting rights.

Some have worked hard “to scare us away,” she added. “But we see the finish line.”

Those stumping for Abrams and Gillum included a virtual who’s who list of black political royalty and celebrity: singer-actress Rihanna, Oprah Winfrey, former president Barack Obama. Yet their star power didn’t make them any less of a target of both direct and subtle racial digs.

Less than a day after Gillum won his party’s primary, DeSantis told a crowd that voters can’t afford to “monkey this up,” a turn of phrase many interpreted as a racist dog whistle.

Shortly afterward, the Democrat was the subject of a “We Negroes” robo-call that featured the sounds of drums and monkeys in the background. “Well, hello there. I is Andrew Gillum,” the call began. “We Negroes . . . done made mud huts while white folk waste a bunch of time making their home out of wood an’ stone.”

In Georgia, one of the most racially charged jabs at the 44-year-old Abrams came in the form of a robo-call to voters last week that featured a voice impersonating Oprah Winfrey and calling Abrams “a poor man’s Aunt Jemima.”

Sandra Brandon caught a glimpse of Abrams when she popped into the Busy Bee Cafe on Martin Luther King Jr. Boulevard in Atlanta on Tuesday afternoon. The Rev. Jesse Jackson was there to greet her.

Brandon, who remembers when segregationists such as Lester Maddox ruled the government in the late 1960s, said Abrams’s candidacy is “very important. It’s like Obama — something that you thought would never happen, that you dreamed might, but not in my lifetime.”

In the election’s closing days, Trump strongly criticized both Democratic candidates, calling Gillum “not equipped” and Abrams “not qualified” to be governor despite their long experience in government. Tuesday, the president took fresh aim at Gillum, claiming that he would turn Florida into “a crime-ridden, overtaxed mess” if elected.

Voter access remained a concern in Georgia into the evening given the policies that Kemp tried to push through. His current position as secretary of state puts him in charge of election operations — essentially making him both competitor and referee. According to preliminary results by AP VoteCast’s Georgia survey, nearly 3 in 10 voters in that race said they were not confident that people eligible to vote would be allowed to do so.

Kemp’s actions as secretary of state came under sharp scrutiny in the wake of an Associated Press report that he had stalled more than 50,000 voter registrations by disproportionately black voters under the state’s “exact match” signature requirements.

Friday, a federal judge ordered Georgia to change its procedures to make it easier for some people flagged under the state’s restrictive law to cast a ballot.

Regardless of the final result in these and other banner races, activists in black communities said the 2018 election redefined their efforts. Many of the groups that have been most active did not even exist until when Trump became president.

Atlanta activist LaTosha Brown, 47, attributes the increase in black candidates on the ballot to African Americans who decided to take control of their political fates rather than leave those in the hands of the Democratic Party. Two years ago, Brown co-founded Black Voters Matter, a grass-roots effort focused on organizing and mobilizing African Americans across the South. Since 2016, several other political groups have come into being, including Black PAC, Collective PAC and Woke Vote.

“Our community had a wake-up call in 2016,” Brown said, citing the election of Trump and his choice of advisers like Stephen K. Bannon and cabinet members like Attorney General Jeff Sessions. “We knew that we could not continue down this road. We recognized that our fate could not be tied to waiting on someone else to save us.”

Matt Viser, Scott Clement, Cleve R. Wootson Jr. and Eugene Scott contributed to this report.