Republican Jim Hagedorn was elected to Congress in southern Minnesota’s First District, defeating the DFL’s Dan Feehan in a fiercely contested race that was closely watched by both national parties.

With all precincts reporting, Hagedorn finished with 1,311 more votes than Feehan.

Feehan said Wednesday that he'll wait for official canvassing results before deciding his next move in the race.

The open seat, which Democratic Rep. Tim Walz represented for 12 years until his bid for governor this year, drew $13.8 million in campaign spending by outside groups. Democrats tried to hold a seat Walz won over Hagedorn by less than 1 percentage point in 2016, while Republicans hoped to gain advantage after President Trump’s 15-point win in the district that year.

Hagedorn, who worked for the U.S. Department of Treasury, made the case that it’s time for a Republican to represent the district and that he will work closely with the president.

Feehan presented himself as a moderate, and says he wants Congress to be a check on Trump. He completed two combat tours of duty in Iraq, then served as acting assistant secretary of defense during the Obama administration.

Republican groups ran ads questioning Feehan’s patriotism. Feehan called attacks on his military career disrespectful.

In an agricultural part of the state where many businesses count on immigrant labor, Feehan has supported a path to citizenship for immigrants who pay taxes and don’t have criminal records. Hagedorn backs a system permitting people to work in the United States and earn credits toward citizenship.