Sen. Jeanne ShaheenCynthia (Jeanne) Jeanne ShaheenSome employees' personal data revealed in State Department email breach: report Dems seek ways to block Trump support for Saudi-led coalition in Yemen Hillicon Valley: Trump signs off on sanctions for election meddlers | Russian hacker pleads guilty over botnet | Reddit bans QAnon forum | FCC delays review of T-Mobile, Sprint merger | EU approves controversial copyright law MORE (D-N.H.) pulled out a hard-fought victory over Republican Scott Brown, holding onto a must-win seat for Democrats Tuesday night.

The race had Democrats sweating in the final days, as Brown, a former senator from Massachusetts, managed to narrow Shaheen’s initially solid lead to a virtual tie. 

ADVERTISEMENT

It marks Brown’s second loss, and third Senate run, in four years. 

He focused heavily on national security, tying Shaheen to President Obama and calling the two “confused” on how to tackle threats to America’s safety. 

Brown was helped by the last month of national security crises. He hammered Obama’s response to the growing threat of the Islamic State in Iraq and Syria and the spread of Ebola as inadequate, and Shaheen for what he characterized as unquestioning support for Obama’s flawed strategies.

But as aggressively as Brown worked to nationalize the race, Shaheen worked to narrow it to local issues and her work for New Hampshire, going back to her time as governor.

She also made frequent mention of Brown’s move to New Hampshire shortly before launching his bid. Democrats saw that as damning evidence in their argument that Brown was merely an opportunist carpet-bagger only in the race for his own interests, not New Hampshire's.

Brown himself contributed to that perception with multiple gaffes in which he appeared to forget what state he lived in. And on Tuesday, he dodged a question on whether he’d head back to Massachusetts if he lost his race.

Still, Democrats took Brown seriously as a challenger, in part due to his strong fundraising abilities. He raised about half of Shaheen’s $14.6 million in a fraction of the time, after launching his bid in April.

And his ability to keep the race close at the end was a testament to the tough climate for Democrats nationwide. New Hampshire, a blue-leaning purple state, was seen as a key seat for Democrats to hold if they were to have any hopes of holding onto the Senate.

Democrats had already lost three states of their six-seat majority when Shaheen won her race Tuesday night.

This post was updated 9:27 p.m.