New Jersey Gov. Phil Murphy narrowly won his race for a second term Wednesday night, to the relief of Democrats stunned by their loss in Virginia, but the narrow margin and a strong Republican surge across the Garden State left them alarmed and wondering what went wrong.

As the Associated Press projected Murphy the winner late Wednesday, his lead was about 1 percentage point, with several parts of the state yet to be counted. Polls ahead of Election Day, in contrast, had showed Murphy with a comfortable — in some cases, double-digit — lead over Republican Jack Ciattarelli in a state President Biden won by 16 percentage points in 2020.

Shortly after the race was called, Ciattarelli’s campaign signaled that a concession was far from imminent.

“With the candidates separated by a fraction of a percent out of 2.4 million ballots cast, it’s irresponsible of the media to make this call when the New Jersey Secretary of State doesn’t even know how many ballots are left to be counted,” Ciattarelli spokeswoman Stami Williams said in a tweet.

As they mulled over the election results, some New Jersey Democrats blamed Biden. Some blamed Murphy. And some blamed both.

Former senator Robert G. Torricelli (D-N.J.) said that loyal Democrats turned out but that Biden’s missteps — on Afghanistan, covid and his legislative agenda — alienated centrist voters. “I think the base was fine,” Torricelli said. “This wasn’t the base. It was the persuadable voters.”

Murphy made a seemingly dismissive comment about residents who care about high taxes, but harmful as that was, Torricelli said, it was exacerbated by the national climate: “A single gaffe should not have been enough to create this kind of damage.”

Rep. Bill Pascrell Jr. (D-N.J.) interpreted Murphy’s near-loss as a reflection of voters’ dissatisfaction with congressional inaction on crucial issues and said it should be “an alarm clock rousing us from sleep.”

“They elected a Democratic government to end the pandemic and get life back to normal,” Pascrell said. “Republicans do not give a damn about regular Americans, but we are in charge. If we don’t deliver, then we won’t deserve to govern.”

Even though Murphy was able to hang on Wednesday, the closeness of his race was in some ways more shocking to Democrats than their loss in Virginia. New Jersey has a long Democratic tradition and a strong edge for the party in voter registration; Biden’s victory margin in 2020 was substantial, and pre-election polls gave no hint that Murphy was in danger.

The outlook for Democrats was equally grim in races for the state legislature. In one surprising turn, Republican challenger Edward Durr Jr., a truck driver who raised less than $10,000 but spent less than $200 on his entire campaign, toppled state Senate President Steve Sweeney, who had won easily in 2017.

The governor, Durr argued, had stripped New Jersey residents of their rights by imposing an array of restrictions during the pandemic. “Our legislature sat by and allowed this to take place without one word out of the Senate president or the speaker,” Durr told a conservative YouTube interviewer shortly before the election. “They forfeited any right to reelection.”

Ian Smith, co-owner of Atilis Gym in South Jersey, was arrested last summer for keeping his gym open despite covid restrictions, an episode that ricocheted around conservative media. He said Wednesday the Republican surge did not surprise him.

“We don’t have a lot of people who were able to work from home here,” Smith said. “When you’re at home, getting paid to work, you’re not feeling it the same way that a contractor is.”

He added, “It’s extremely close because a lot of people decided to vote for the guy who said he wasn’t going to do mandates and teach CRT in schools,” Smith said, referring to the academic framework known as critical race theory.

In a statement Wednesday, Williams, the Ciattarelli campaign’s spokeswoman, highlighted the GOP wins across the state while also emphasizing the need to count all “legal votes,” a phrase reminiscent of Trump’s repeated baseless claim that the 2020 election was marred by fraud.

“Last night was a historic one for New Jersey Republicans, who picked up at least a half dozen Assembly seats, several Senate seats, along with county and local seats up and down the state,” Williams said.

Murphy’s campaign has cast the election as historic because he will be the first Democratic governor of New Jersey to be reelected in 44 years.

According to two Murphy aides who spoke on the condition of anonymity because they were not authorized to publicly discuss the race, the campaign had not drawn any conclusions yet about the reasons for the Republican surge — whether it was fueled by strong anti-Biden sentiment, pandemic-related restrictions or a general backlash against Democrats. But their own internal polling, they said, also missed the strength of the Republican energy.

The aides also said that despite Biden’s poll numbers, Murphy’s campaign decided to proceed with plans for the president and Vice President Harris to visit the state because they wanted to show solidarity with the White House.

Murphy defended his leadership in remarks to supporters Tuesday night, declaring, “We’re leading with compassion and empathy, not anger and despair.”

Yet it was clear there was dissatisfaction among Democrats over the governor’s handling of his job.

Murphy, whose popularity soared over his handling of the coronavirus pandemic when New Jersey and New York were hit with the first wave, did not shy away from his big-government policies during the campaign, arguing that the state’s taxes translate to some of the best public schools and health care in the country.

As the pandemic dragged on, some Republicans dragged out comments Murphy had made on taxes two years earlier.

“If you’re a one-issue voter, and tax rate is your issue — either a family or a business, if that’s the only basis upon which you’re going to make a decision — we’re probably not your state,” Murphy said during an October 2019 forum at Rowan University.

The remarks became a focus of Ciattarelli’s campaign. “ ‘Not your state?’ Who says that? Phil Murphy just doesn’t get it,” Ciattarelli says in one of his campaign ads.

Torricelli, who left the Senate in 2003 after being formally admonished over campaign finance violations, likened Murphy’s comment on taxes to former Virginia governor Terry McAuliffe’s (D) statement at a recent debate that parents should not be “telling schools what they should teach.”

Both Democrats became vulnerable, Torricelli argued, as voters grew increasingly dissatisfied with Biden’s performance on a range of issues, and he urged Democrats in Congress to focus on passing bills that resonate with average Americans.

“If I were in the Democratic caucus in the Senate, I would heed what happened yesterday,” Torricelli said. “There is a conflict between the desire to serve the base of the Democratic Party and the direction that persuadable independent voters in the country want.”

Still, the results suggest that a Republican surge — not lackluster Democratic turnout — was behind Ciattarelli’s better-than-expected performance.

In 2017, Murphy won with the votes of more than 1.2 million New Jerseyans, compared with nearly 900,000 for his Republican opponent, Kim Guadagno.

By Wednesday evening, Murphy had already passed his 2017 raw vote total. It was Republicans who saw a marked change in turnout, with Ciattarelli earning nearly 300,000 more votes than Guadagno had four years earlier.

Lisa Camooso Miller, a former New Jersey Republican operative, said Ciattarelli benefited from GOP dissatisfaction with Biden and Murphy, while Guadagno — who has since left the Republican Party — was in a more difficult position as the lieutenant governor to New Jersey Gov. Chris Christie (R).

“If I had to guess, I would say that [enthusiasm] was low among Republicans when the time came to vote ultimately for a third term for the Christie ticket,” Miller said. “But now, after four years, Republicans came out very strongly in favor of Jack Ciattarelli because they were deeply dissatisfied with how Murphy performed in the governor’s office.”

Former New Jersey governor Christine Todd Whitman said the performances of Ciattarelli and Republican Glenn Youngkin in Virginia hold lessons for other Republicans in how to manage their relationship with former president Donald Trump.

“You want to accept the Trump base — you want it to come out and vote for you — but you don’t want to get too close to Trump,” said Whitman, a vocal Trump critic.