Establishment Republicans and their big-money allies are rushing to build a multistate defense system to protect Senate and House candidates, fearing that the party could lose its hold on Congress if Donald Trump is at the top of the ticket in November.

The anxiety about Trump’s potential spillover effect on down-ballot races was underscored Wednesday when House Speaker Paul D. Ryan of Wisconsin lamented the “disheartened” state of the campaign and criticized the “identity politics” on display in the increasingly toxic race for the GOP presidential nomination.

The efforts are being driven by major players such as the Koch brothers’ political network, which has already begun laying groundwork in Colorado, Ohio and Pennsylvania, along with the Crossroads organizations and the U.S. Chamber of Commerce.

The behemoth Koch operation — which aims to spend almost $900 million before the November elections — is now considering abandoning Trump as a nominee and focusing its resources on behalf of GOP congressional candidates.

A key element of the strategy will be a springtime wave of television ads that slam Democratic contenders and tout Republican incumbents as attuned to hometown concerns. Strategists hope the efforts will help inoculate congressional candidates against association with Trump’s incendiary remarks.

Allies of Sen. Kelly Ayotte launched an ad this week praising her work on the heroin crisis, part of an early effort to protect Senate Republicans from the Trump effect. (Jim Cole/AP)

“If there are crosscurrents that are potentially harmful, the most important thing you can do is aggressively localize the race — the things that matter back home, the problems you’re solving,” said Steven Law, a former top aide to Senate Majority Leader Mitch McConnell who leads the American Crossroads super PAC and a suite of related groups.

In New Hampshire, Law’s advocacy group One Nation began a $1 million ad campaign this week praising Sen. Kelly Ayotte (R) for seeking “bipartisan solutions” to fight the heroin crisis in her state. In Ohio, the Freedom Partners Action Fund, a super PAC financed by billionaire industrialist Charles Koch and other conservative donors, is running a TV spot attacking Democratic candidate and former governor Ted Strickland for tax increases during his administration.

The groups are being bolstered by some of the party’s biggest donors and fundraisers, many of whom have turned their funds toward congressional Republicans after seeing their favored candidates forced out of the White House race.

“The biggest concern for me is the next Supreme Court justice and that we do not lose the Senate,” said Idaho nutritional-supplement executive Frank VanderSloot, who had backed Sen. Marco Rubio of Florida and is now giving large sums to congressionally focused groups. “If Donald Trump is the nominee, we could see a lot of people staying home.”

Mike Shields, president of the Congressional Leadership Fund, a super PAC allied with House leadership, said nearly every conversation he has had with donors lately centers on the need for a firewall.

“What they see at the top of the ticket has a lot of them concerned,” Shields said. “They’re saying, ‘We’ve got to keep the House; we’ve got to keep the Senate.’ ”

Trump campaign manager Corey Lewandowski rejected the idea that the billionaire real estate developer would be a drag on the GOP ticket, saying the huge crowds he is turning out at rallies and in the primaries prove that Trump would energize the party and expand its appeal.

“What you see is that people are turning out in mass quantities to support his campaign for the president of the United States, and that will continue to translate in the general election,” Lewandowski said, adding: “They are going to help everybody down the ballot.”

Even without a controversial presidential candidate to contend with, Senate Republicans face a challenging map. Fresh off reclaiming the majority for the first time in eight years, the GOP now faces the daunting prospect of defending 24 of the 34 Senate seats that are up for grabs this November, largely because the six-year terms for the many Republicans who swept into office in the 2010 elections have come due.

The party can afford to lose only three seats to stay in the majority, and at least two incumbents are already facing difficulties: Sens. Mark Kirk (R-Ill.), whose state is seen as a prime pickup opportunity for Democrats, and Ron Johnson (R-Wis.), who is struggling in the polls. Five more GOP seats are up for grabs in states that President Obama won twice, including some, like Pennsylvania, by comfortable margins.

“Loud foot­steps up­stairs in the pres­id­en­tial race could eas­ily shake the Sen­ate races be­low,” veteran analyst Charlie Cook wrote this week, adding that if the GOP loses the White House by a larger margin than it did in 2008 or 2012, “hanging onto the Sen­ate would be a long shot at best.”

If Trump is the nominee, Democrats have already signaled that they plan to try to link him to every Republican running this fall. The Democratic Senatorial Campaign Committee has rolled out a “Party of Trump” campaign dubbing GOP candidates as “Retrumplicans.”

Many Democrats are expected to follow the lead of Rep. Ann Kirkpatrick of Arizona, who is challenging Sen. John McCain (R). Last month, she released a web ad compiling some of Trump’s most inflammatory statements, followed by a clip of McCain saying he will support the Republican nominee. “We need leaders to stand up to Donald Trump,” the narrator says.

Some Democrats are hopeful they can even threaten the GOP’s lead in the House.

Alixandria Lapp, executive director of the House Majority PAC, a Democratic super PAC, said she thinks congressional Republicans “are going to be dragged down by the anger of Trump around their necks.”

“Donors are getting excited about not just the possibility of keeping the presidency, but could we actually give the president a Congress to work with so we could make progress on issues we care about?” she said.

The stakes are expected to trigger a costly air war. Already, independent groups have spent more than $23.5 million on congressional races, with the largest share — $5.1 million — pouring into Ohio, according to a Washington Post analysis of campaign finance filings.

There will be more to come. Together, the Democratic and Republican congressional committees raised more than $287 million by the end of February, while 70 super PACs focused on Senate and House races had collected $144 million, The Post found.

That does not include money flooding into advocacy groups such as the U.S. Chamber of Commerce, which is planning to provide Senate Republicans with major air cover.

“We think early money sets the terms of the debate, and we’re gearing up,” said Scott Reed, the Chamber’s chief political strategist, who added that his organization plans to zero in on local issues “like folks are running for sheriff.”

Congressional Republicans may also get a major boost from the Koch network, which is strongly considering focusing solely on Senate and House races if Trump is the nominee, according to people familiar with the network’s plans.

Mark Holden, chairman of the board of Freedom Partners, the network’s funding arm, said it would jump into the White House race in the general election only if “a candidate were able to garner support from the public with a positive message in support of the issues we care about, and did not engage in personal attacks and mudslinging.”

“That hasn’t happened yet, and there is no indication that this will happen, given the current tone and tenor of the various campaigns,” he added.

Instead, the network has been making forays into key Senate states. A top target is Ohio, where the Koch-backed advocacy group Americans for Prosperity ran an ad last August hitting Strickland for job losses in the state. Meanwhile, the Koch-backed Concerned Veterans for America has taken the lead in running ads praising Sen. Patrick J. Toomey of Pennsylvania and Rep. Joseph J. Heck, a Republican seeking to replace Sen. Harry M. Reid, the chamber’s Democratic leader, in Nevada.

Meanwhile, the Crossroads operation is contemplating playing in a larger number of Senate races than it originally planned. The organization has already raised at least $24 million for its Senate efforts, and there is an appetite among donors to do much more, Law said.

“What I do see going on, at least right now, is what they call in the stock market ‘a flight to quality,’ ” he said.

After the 2014 Senate victories of Republicans Cory Gardner in Colorado, Joni Ernst in Iowa and Thom Tillis in North Carolina, “there is a sense of urgency that we keep them there, that we not lose ground,” Law said, noting that donors feel “we’ve got to find a place that is an insurance policy against everything else possibly going wrong.”

Anu Narayanswamy contributed to this report.