Rep. Kyrsten Sinema (D-AZ) won one of the tightest races in the country on Monday, breaking a decades-long Republican winning streak to become the first female U.S. senator from Arizona.

Sinema, a three-term congresswoman from the Phoenix suburbs, defeated Republican opponent Rep. Martha McSally, after nearly 600,000 mail-in ballots, most from populous Maricopa County, were finally tallied. The so-called “late earlies” are the result of a quirk of Arizona election law, which allows voters to drop off early ballots at polling places as late as Election Day. Those ballots are then hand-processed, a time-consuming process that can take more than a week in a state where only one in five voters cast ballots in a voting booth.

Sinema will replace retiring Sen. Jeff Flake, a Republican whose public criticism of President Donald Trump likely doomed his chances of surviving a primary contest for reelection this year.

Sinema won Arizona’s first competitive senate election in decades after running a campaign that highlighted her compelling personal story and her centrist congressional record—and by calling out McSally’s tight embrace of Trump as out-of-step with state’s independent-minded electorate.

“I couldn’t be more proud to have support from Democrats, independents, and Republicans in this campaign, because it‘s a hallmark of who we are and what we do” in Arizona, Sinema remarked to reporters in the final days of the campaign. “This is why I’ve been ranked the most bipartisan member of the House; it’s why I have been ranked the third-most independent member of the House—it’s because this approach works.”

Sinema, who grew up poor in a remodeled gas station in the Florida Panhandle, worked as a social worker in Arizona, then became an anti-war activist affiliated with the state’s Green Party, a political history that McSally pointed to as evidence of far-left extremism. But after winning election to the state’s legislature as a Democrat, and later the House of Representatives, Sinema largely voted as a centrist, reflecting a suburban district that skewed to the right.

In a campaign swing through Arizona, Trump noted McSally’s history as a former combat pilot, lauding her as “brilliant and brave” and Sinema as “very, very strange.”

“Martha’s opponent is a far-left extremist,” Trump said at the time. “This is what you want as your senator?”

In winning, Sinema successfully dodged McSally’s attempts to paint her as as a treasonous, tutu-wearing radical leftist. McSally even sent out a press release reminding voters that those found guilty of treason “shall suffer death,” a campaign strategy that drew sharp condemnation from fact-checkers, and contributed to the normally right-tilting Arizona Republic’s editorial board’s endorsement of Sinema’s candidacy, its first for a Democratic Senate candidate in nearly two decades.

Sinema will be the first out bisexual person elected to the Senate, and was a vocal opponent of state ballot initiatives that would ban same-sex marriage under the Arizona constitution.