The news landed like a bombshell a week before New Jersey’s pivotal legislative races: Orsted, a Danish company that had been hired to build two wind farms off the South Jersey coast, was abruptly abandoning the project.

Overnight, a linchpin of Gov. Philip D. Murphy’s clean energy plan vanished, unleashing finger-pointing among his fellow Democrats, who are fighting to retain control of the Legislature, and I-told-you-sos from Republicans, who had opposed the offshore-wind projects.

Orsted cited broad economic forces, including higher building costs, as the reason for pulling out, but it retained the rights to the seabed lease, preventing New Jersey from immediately bringing in another company to develop the site.

“The Republicans are going to do a victory lap,” said Jeff Tittel, a longtime New Jersey environmental advocate who supports the development of offshore wind farms, “while the Democrats have egg on their face.”

In 2021, with Mr. Murphy at the top of the ticket, Republicans gained seven seats in the Legislature, which Democrats control, when voters, angry about the state’s Covid-19 mandates, turned out in droves. Stephen M. Sweeney, a Democrat who was State Senate president at the time, lost to Edward Durr Jr., a conservative, first-time candidate.

Republicans hope to tally further gains when voters go to the polls on Tuesday, as Democrats try to recover lost ground. Some Republicans have speculated about the possibility of flipping either the Assembly or the Senate, something that has not occurred in two decades and that would require virtually every competitive race to cut their way.

All 120 legislative seats are on the ballot. Democrats hold a 46-34 majority in the Assembly and a 25-15 advantage in the Senate.

“We’re close enough to the target,” Alexandra Wilkes, a New Jersey Republican Party spokeswoman, said about winning a majority, “but we have to hit the darts right every time.”

There are highly competitive races in South Jersey, in legislative Districts 3 and 4; along the Jersey Shore, in District 11; near Princeton, in District 16; and in Bergen County’s District 38.

A lawsuit filed on Thursday, and the accusations that underpin it, illustrate how high each party considers the stakes.

In the suit, filed in Atlantic County, Republicans asked a judge to take steps to blunt what they said was a dirty-tricks campaign by Democrats in the fourth legislative district. The complaint cited “phantom candidates,” whom the plaintiffs argued were on the ballot solely to siphon off Republican votes.

On Friday, a judge blocked future spending by a group funding the Democratic candidates. Ms. Wilkes said Republicans were pleased the court had recognized the “egregious violation of the public trust.”

Much of the campaign rhetoric has involved cultural wedge issues, including abortion rights and whether schools should be required to tell parents about how students express their gender. State policies meant to make residents less dependent on gas-powered stoves and vehicles have also been used by Republicans to energize their base. Orsted’s announcement added force to that rallying cry.

Assembly Republicans produced a mocking video. Senator Michael Testa, a South Jersey Republican who represents shore communities where opposition to wind energy is strongest, called the Orsted deal a “boondoggle.”

Voting by mail began over a month ago, and early machine voting has taken place over the past two weeks. With no statewide office on the ballot, though, Election Day turnout is expected to be low.

LeRoy J. Jones Jr., the New Jersey Democratic State Committee chairman, said the party’s focus this cycle had been on expanding its base by adding “younger and less consistent voters.”

“It’s all about get-out-the-vote now,” Mr. Jones said on Tuesday.

During the legislative elections in 2021, Mr. Murphy, who governed as a steadfast liberal in his first term, became New Jersey’s first Democratic governor to win re-election in 44 years. But he won by just three percentage points.

Since then, he has governed as more of a moderate, talking regularly about affordability. In June, he signed a bill geared toward cutting property taxes for most older homeowners by 50 percent beginning in 2026. Democrats have featured the tax cut prominently in their campaigns.

A loss or significant erosion of the Democratic majority in either house could be politically damaging to Mr. Murphy in a state where Democrats outnumber Republicans by nearly a million voters.

It might also dim the political prospects of his wife, Tammy Murphy, who is expected to enter the race for Senator Robert Menendez’s seat as early as next week. Ms. Murphy, who has championed reproductive rights, joined her husband last week at an event where he promoted a new website where residents can get information about abortion services.

Several Democratic lawmakers in tight races attended the event, a sign of how potent they believe reproductive rights may be as an issue this year.

Senator Joseph Lagana, a Democrat, said voters appeared concerned that abortion rights could be curtailed in New Jersey, where the procedure remains legal, after the Supreme Court overturned Roe v. Wade.

“It’s a very real issue,” Mr. Lagana said. “It’s a driving factor.”