PHOENIX — Arizona officially has its first female senator to represent the state in Washington, D.C., and her name is Kyrsten Sinema.

Sinema, the Democratic candidate, defeated her Republican opponent, Martha McSally, by 49.68 percent to 47.96 percent as of 5:30 p.m. on Monday.

McSally conceded on her campaign Twitter account Monday night.

Congrats to @kyrstensinema. I wish her success. I’m grateful to all those who supported me in this journey. I’m inspired by Arizonans’ spirit and our state’s best days are ahead of us. pic.twitter.com/tw0uKgi3oO — McSally For Senate (@MarthaMcSally) November 13, 2018

The result came on Monday, six days after the Nov. 6 midterm election. The delay of the result came as election officials slowly counted the more than 600,000 outstanding votes in the narrow U.S. Senate race.

As county recorders’ officials were counting the ballots — the majority of which were in Maricopa County — four county Republican parties filed a lawsuit alleging the state’s 15 county recorders don’t follow a uniform standard for allowing voters to adjust problems with their mail-in ballots, and that two counties improperly allow those fixes after Election Day.

The settlement reached allowed county recorders more time to “cure” mail in ballots and continue counting votes.

Despite the lawsuit, Maricopa County Recorder Adrian Fontes assured voters who cast a ballot for Tuesday’s election that elections officials would count all ballots.

“I think every valid vote should count. I think every eligible United States citizen who is casting a valid ballot that is verified should have that ballot count,” Fontes said during a Thursday press conference.

“And today, an attempt to stop that process from continuing forward in Maricopa County, for the first time, where Maricopa County residents and voters and citizens now have that short cure period, they wanted to stop that from happening. And the judge told them no.”

The election came at the end of a divisive campaign season to replace outgoing Republican Sen. Jeff Flake that highlighted issues such as health care, border security, immigration and more.

But Sinema’s win was not always obvious: Out of 10 Senate polls conducted in October, according to RealClearPolitics.com, she was leading in all but four, with one Fox News poll showing a tie.

A poll released shortly before Election Day by Trafalgar Group found that Sinema held a three-point lead over McSally, 50 percent to 47 percent, but McSally held a mere 0.2 percent over Sinema when taking undecided voters into account.

The contest also saw more than $90 million in spending, including more than $58 million by outside groups backing one candidate or the other, according to Federal Election Commission reports.

The race also took a bit of a turn in its final days, when Angela Green, the Green Party candidate in the race, announced she was looking to drop out and endorsed Sinema — four days before Election Day.

“I want (voters) to vote for a better Arizona, and that would be for Kyrsten Sinema, the Democratic Party,” she told 12 News’ Brahm Resnik.

“There’s a lot of other reasons that I can’t support the other candidate, but my main reason is that they are more in line with what my political agenda is and what’s I’m looking to do to help Arizona become more green again.”

Sinema’s campaign has highlighted her willingness to work across party lines — including her record of voting with President Donald Trump 62 percent of the time — but has been hindered by actions she took in the past as a Green Party and anti-war activist.

Sinema avoided bringing in top-name Democrats such as former President Barack Obama, a polarizing figure who could turn off some in the middle, and former Vice President Joe Biden who have stumped for candidates in other states.

Instead, she focused the entire election on centrist voters, independents and Republican women, zeroed in on health care, education and veterans issues and focused on meeting voters, holding small events and rallying supporters in a bid to win in red state Arizona.

Sinema also has avoided endorsing specific ideas backed by other high-profile Democrats, such as the Medicare for All plan that’s been promoted most notably by Sen. Bernie Sanders of Vermont.

Instead, Sinema has said she wants to maintain what’s been working in the health care system, including keeping protections for people with pre-existing conditions and fix what hasn’t been.

“I have been focused on supporting realistic proposals that help Arizonans get access to affordable coverage,” she said at an October event.

Sinema has also said that she supports a move made by military officials to enhance protections at the border as a group of Central American migrants make their way through Mexico in an attempt to seek asylum in the United States.

“I’ve long supported having additional support on the border because our men and women who are keeping our border safe and secure do need help and support to do that,” Sinema told KTAR News 92.3 FM’s Arizona’s Morning News last month.

Besides becoming the state’s first female senator, Sinema’s win also ensures that Arizona will have its first Democratic senator since the mid-1990s.

The other Senate spot in the state is currently being held by U.S. Sen. Jon Kyl, who was appointed by Gov. Doug Ducey in September after Sen. John McCain died from brain cancer.

Whether the seat would continue to be held by Kyl was unclear: Kyl has said he would only serve until January; if so, the Arizona governor would appoint another Republican to fill the spot — that Republican could be McSally.

Voters will decide in a 2020 special election who fills the remainder of McCain’s seat through 2022. Then the seat will be up again for a full six-year term.

Flake won the U.S. Senate election in 2012 by 3.5 percentage points.

The Associated Press contributed to this report.

Follow @KTAR923