New Hampshire voters set up a historic House race on Tuesday, one that will result in the election of either the state’s first openly gay or first African American member of Congress.

Democrats picked openly gay Manchester politician Chris Pappas as their nominee in the 1st congressional District, while Republicans went with Eddie Edwards, a black former police chief, in their primary.

The district, which includes Manchester and the state’s coastline, has frequently changed hands between the parties; in 2016, Rep. Carol Shea-Porter (D) carried it by just 1.4 points while Hillary Clinton lost it by almost the same margin.

But the race quickly became a battle between Pappas and Iraq War veteran Maura Sullivan — which Pappas won in a rout. Levi Sanders, who did not live in the district, trailed far behind. The GOP’s primary was closer, with Edwards holding a steady lead over state Sen. Andy Sanborn, who conceded three hours after the polls closed.

Pappas, who won his first race when he was 22, had long been tipped for higher office. He was endorsed by the state’s Democratic senators and by Rep. Ann Kuster (D). In ads, he highlighted his experience running the popular Puritan Backroom restaurant and noted that nearly all of his donations came from New Hampshire.

That was easy to hear as a swipe at Sullivan, an Illinois native who moved to New Hampshire last year and quickly put together a congressional bid. She raised $1.8 million — more than doubling Pappas’s $800,000 — with just 3 percent of it coming from New Hampshire. Her high-profile supporters, including Emily’s List and Rep. Seth Moulton (D-Mass.), urged voters to focus less on where she came from and more on her record as a veteran and Obama administration appointee.

“I serve now in Congress with a lot of members who don’t happen to represent where they grew up,” Moulton said after a July appearance with Sullivan.

With few policy differences separating the candidates — both Pappas and Sullivan favored a “public option” to expand Medicare — the race often became about Sullivan’s record and roots.

After Sullivan said in TV ads that she “fought” in Iraq, Republicans demanded that she prove she engaged in combat, an attack she called ignorant. After it was revealed that she had failed to vote in the 2010 and 2014 primaries, other candidates accused her of insulting the process.

The Republican primary, at times, grew even nastier. Sanborn, a libertarian-minded businessman who had won several tough races, led the field in fundraising. But he couldn’t crowd out Edwards, who trumpeted his endorsements from Trump allies like former New York mayor Rudolph W. Giuliani.

The key dispute in the race was over a probe by the state’s attorney general into whether Sanborn once made inappropriate comments around a staffer, who was moved out of his office. The senator has flatly denied that he acted badly, and the investigation found no wrongdoing.

“I’ve never seen such a level of fake news,” Sanborn told NHPR in June. “Look, five years ago I responded to a joke with a friend of mine, and we were just joking. And now, five years later, people are still trying to create something out of nothing.”

But Edwards warned that the scandal would make Sanborn unelectable — a potent charge in the district, where former congressman Frank Guinta (R) was undone by a campaign finance scandal.

“We can’t afford to put somebody on a stage who cannot stand up and hold our values,” Edwards said at one of the final debates.

There was less intrigue ahead of Tuesday’s other primaries, in races where incumbents are heavily favored to win. In the Democrats’ race for governor, state Sen. Molly Kelly easily defeated Steve Marchand, a former mayor of Portsmouth who also ran and lost in the 2016 primary.

Political handicappers and pollsters see a strong advantage for Republican Gov. Chris Sununu, who has benefited from a growing economy and by sometimes bucking his party’s hard right. But Democrats, energized by a series of special-election wins since the 2016 election, planned to challenge Sununu as a tool of business interests who had signed controversial Republican bills — including one that made it tougher for college students to vote.

Late Monday evening, two Republicans were locked in a race to challenge Kuster (D), who has $2.7 million left to spend on reelection. None of the GOP’s hopefuls had more than $170,000, and the race has not been heavily targeted by Republicans who are on defense in dozens of less Democratic seats.

With their nominees selected, Democrats also saw their heavy turnout as a reason for optimism. More Democrats than Republicans cast votes in the 1st District, and the statewide vote for governor was poised to pass the 72,500 cast in the Democrats’ 2016 primary.

David WeigelDavid Weigel is a national political correspondent covering Congress and grass-roots political movements. He is the author of "The Show That Never Ends," a history of progressive rock music. Follow