Democratic U.S. Rep. Angie Craig will return to Congress for a second term, after the race for Minnesota's Second District was called in her favor Thursday.

Craig was facing Republican challenger Tyler Kistner in an unusual battle that had come under legal challenge. Kistner conceded Thursday afternoon and said he had called Craig to congratulate her.

The result of the contest in the swing district had been unclear immediately after the polls closed, and the outcome shifted as absentee ballots continued to be counted. On Thursday morning, the Secretary of State's office showed Craig with 9,386 more votes than Kistner and a lead of slightly more than 2 percentage points.

The Associated Press called the race later in the morning.

Craig had declared victory Wednesday before the race was called. "I am so grateful to the people of this district for giving me an opportunity to return to Congress to continue this important work," she said.

The district includes much of the southern suburbs and rural communities in the southeast part of the state.

Legal Marijuana Now Party candidate Adam Charles Weeks, who died unexpectedly in September, had a significant impact on the race.

As of Thursday morning, 24,642 people had voted for Weeks. Weeks told a friend before he died that Republicans asked him to run in order to pull votes from Craig.

Weeks' death prompted an ongoing court battle over the race. Craig successfully challenged a state law that would have pushed the race to a special election in February. Kistner, seeking a delay, appealed in federal court.

In a statement, Kistner noted that he broke a record for GOP fundraising in the district, winning more votes there than President Donald Trump.

"Despite lots of confusion in this race caused by Rep. Craig's lawsuit and the courts, we were able to outperform the top of the ticket by 5% and raise more money than any GOP challenger ever in the Second District," he said.

The Marine Corps veteran said he is heading out to drill with the Marine Corps Forces Reserves for a few weeks, but he said he will be announcing future plans soon.

"This is not the end of the movement we have started," he said.

Minnesota Republican Party Chairwoman Jennifer Carnahan praised the first-time candidate's effort. "We're going to see the name Tyler Kistner on the ballot again and look forward to that day," she said.

Craig is a former health care manufacturing company executive and was running a campaign focused on bipartisanship and working with her Republican colleagues to get things done.

She beat Republican U.S. Rep. Jason Lewis in 2018, flipping a district that Republicans had held since 2001.