For indispensable reporting on the coronavirus crisis, the election, and more, subscribe to the Mother Jones Daily newsletter.

The day after the midterm elections, President Donald Trump declared Rep. Mia Love (R-Utah) the loser in her reelection bid against Salt Lake County Mayor Ben McAdams. “Mia Love gave me no love and she lost,” Trump said. “Too bad. Sorry about that, Mia.” But Love hadn’t lost—yet. The race was neck and neck, and it only got closer as the ballots continued to be counted over two weeks.

But Tuesday, the vote-counting concluded and proved that while the president may have been premature in pronouncing Love the loser, he wasn’t wrong. The only black Republican woman ever elected to the House has officially lost her reelection to McAdams by 694 votes, or 0.258 percent of the vote—barely outside the 0.25 percent threshold that would have allowed Love to request a recount.

The upset comes in a district that was specifically gerrymandered to favor Republicans and minimize the influence of liberal Salt Lake City voters, who make up a corner of the district. (Salt Lake City has about 40 percent of the state’s population, and it’s liberal: Hillary Clinton beat Trump there in 2016 by 37,000 votes.) The state hasn’t had a Democratic representative since 2014, when Jim Matheson decided not to run again and paved the way for Love to sail to victory that year.

While the election didn’t reach Broward County levels of chaos, it has been plagued with problems, including 4-hour lines to vote on Election Day in Utah County, Love’s stronghold. Then, for reasons that aren’t entirely clear, Utah County officials spent two weeks counting votes.

Haitian American, Mormon, and conservative, Love rose to prominence with the tea party in 2012, when she first ran against Matheson on a right-wing platform that called for ending the school lunch program and federal student loans—even as she was paying off her own. A former actress and flight attendant who moved to Utah from Connecticut after converting to Mormonism, Love had limited political experience before running for Congress, having served as the part-time mayor of Saratoga Springs, a suburb of Salt Lake City, while she also worked as a fitness instructor.

But since taking office in 2015, Love has struggled with ethics problems and bad press, including a controversy over whether she had been an “anchor baby,” the derogative term conservatives use to describe children born to undocumented immigrants. More recently, she was the subject of a Federal Elections Commission inquiry this fall into her fundraising. Love had raised more than $1 million for a primary she knew she was never going to have, in violation of federal rules.

Love also had trouble navigating the delicate politics of Trump in a state where he was unpopular for a Republican. Trump won Utah, the reddest of states, in 2016, but with 45 percent of the vote, a smaller share than any modern Republican presidential candidate. Love supported Trump’s agenda more than 95 percent of the time in Congress, but she was forced to speak out against some of his most egregious comments about immigration.

The attacks Trump leveled on Haitian immigrants were personal. Love’s parents came from Haiti and worked illegally in the United States before gaining legal status in the 1970s—thanks to her birth, which allowed them a path to citizenship. Trump said last year that Haitians who were coming to the United States “all have AIDS,” and he ended Temporary Protected Status for Haitians who came to the country after the 2010 earthquake, putting nearly 50,000 at risk of deportation. In January, after the Washington Post reported that Trump had said Haitians and other immigrants come from “shithole countries,” Love responded by saying his comments were “unkind, divisive, elitist, and fly in the face of our nation’s values.” She called on him to apologize. (He didn’t.)

For most of the campaign, Love maintained a slight lead in the polls. But Democrats in Utah this year were highly motivated after the results of the 2016 presidential election. Voter registration volume in the state was up significantly over the 2014 midterms, and most of that was led by new Democratic registrations, which have increased 15 percent since 2016. (Republicans also saw higher registration, but only a 6 percent increase.) Those registrations translated into relatively high turnout for a midterm election, with early voting numbers in the state surpassing the entire turnout for the 2014 election by 20 percent. In Utah County, which includes the Provo metro area, turnout was twice what it was in the last midterm election and even beat turnout in the 2016 presidential election, with an estimated 67 percent of the county’s 260,000 residents casting a ballot this year.