Ms. Hassan, 58, entered politics in 1999 to fight for affordable education for disabled people like her son, Ben, who has cerebral palsy. She was elected governor in 2012 and re-elected in 2014, when Democrats were shellacked across the nation. She would have been tough competition even without the Trump millstone around her rival’s neck.

Ms. Ayotte glided into office in 2010 as a tough-minded former state attorney general, billed as one of her party’s rising Young Turks. In the Senate she made impressive independent stands in favor of immigration reform, limits on power-plant emissions and other efforts to combat climate change, and extending expiring unemployment benefits.

But many of her other positions are less appealing. While she stood up to Senator Ted Cruz’s efforts to shut down the government in the battle over Obamacare, she voted repeatedly to repeal the law. She voted to defund Planned Parenthood and ban abortions after 20 weeks. She opposes increasing the federal minimum wage. She joined in the recklessly partisan move to block consideration of Merrick Garland for the Supreme Court. In 2013, in the aftermath of the Sandy Hook shooting, she voted against strengthening background checks for gun buyers.

Ms. Hassan says she’s running to protect the gains New Hampshire has made during her governorship. In a state with no personal income tax or sales tax, she helped to lower the cost of community college and contain state university tuition, expand Medicaid, cut business taxes and achieve a 3 percent jobless rate. She takes a far harder line on immigration than liberals in her party. She would have supported immigration reform legislation, as Ms. Ayotte did, and like Ms. Ayotte, she opposes President Obama’s plan to close the prison at Guantánamo Bay. She stands with her party in supporting Obamacare, abortion rights and efforts to mitigate climate change. On gun safety, she says strengthening background checks and preventing people on the government no-fly list from buying guns “is the very least we should be doing.”

Campaigning at a breakfast forum in her hometown, Nashua, last Sunday, Ms. Ayotte described her Senate record as “finding common ground.” Some in the crowd called it a betrayal. “It seems like every day a child is killed by guns, and yet she hasn’t taken a stand against them,” one woman said. “How do you vote for someone who breaks your heart?”