AS REP. JOE KENNEDY III challenges incumbent US Sen. Ed Markey, Democrats cannot afford to lose sight of the bigger picture. There is little risk of the party losing Markey’s seat in the general election, but a fundraising free-for-all in the primary could divert funds from close contests elsewhere and reduce its chances of retaking the Senate and White House.

While Kennedy has proposed all primary candidates take a “People’s Pledge” to discourage outside spending, the candidates could boost fellow Democrats in other races far more significantly by capping total campaign spending like John Kerry and Bill Weld did in their own Senate race more than 20 years ago.

Massachusetts voters haven’t elected a Republican to the US Senate in a presidential election year — when turnout is higher —- since 1972. Scott Brown won a special Senate election on a snowy January day in 2010, but Elizabeth Warren handily defeated him two years later during Barack Obama’s re-election. While voters have elected Republicans in six of the last eight gubernatorial elections, in part to balance the Democratic Legislature, they are unlikely to send one to Washington as a potential additional vote for Senate Majority Leader Mitch McConnell and President Trump.

There is, however, real risk the Senate primary could pull in dollars better spent on pivotal Senate races and the presidential contest in other states. In neighboring New Hampshire, Democratic incumbent Sen. Jeanne Shaheen will face a competitive Republican challenge. In Maine, incumbent GOP Sen. Susan Collins is vulnerable, presenting an opportunity for Democrats to regain that seat and take control of the Senate. Trump, meanwhile, is targeting both states. New Hampshire is a key swing state, and there is a plausible scenario in which Maine’s Second Congressional District, whose winner earns one of the state’s four electoral votes, could determine the Electoral College outcome.

Those races will attract significant investment from out-of-state donors who increasingly fuel key competitive races. According to the Center for Responsive Politics, the 2018 US Senate candidates in Texas raised more than $70 million in out-of-state funds; Warren and Brown raised $24 million in 2012 from outside of Massachusetts. The candidate with more money won 80 percent of all Senate races between 2000 and 2016, according to FiveThirtyEight, driving candidates to fundraise as much as possible.

Kennedy and Markey each boast more than $4 million in their campaign accounts and appear poised to raise much more. Independent groups like Environment Massachusetts are also launching their own fundraising efforts for the race. While some funds that the candidates raise might be money that would only have gone to their race, a healthy portion will likely come at the expense of the presidential campaign and competitive general election Senate races in other states.

Kennedy and Markey could prevent Democrats from spreading themselves too thin by following Kerry and Weld’s lead in limiting spending. Kerry and Weld agreed to a $6.9 million spending cap, including no more than $5 million on television advertisement, in their epic 1996 Senate contest. They also elevated the campaign through a structured focus on the issues, squaring off in eight televised debates that enabled them to demonstrate their policy chops and sufficiently draw distinctions between them.

Times have changed with the rise of independent expenditures, online campaigning, and disinformation, and costs have escalated. Campaign finance reform is also not as hot-button a topic as it was 20 years ago, and enforcing a voluntary cap in a spirited election admittedly presents challenges. Kerry and Weld accused one another of violating the terms of their agreement near the end of their race, which Kerry decisively won.

But given how high the stakes are for Democrats nationally in an increasingly volatile political climate, Kennedy and Markey should consider similarly capping their own campaign spending at a reasonable amount and focusing on the issues. The state Democratic Party could help to broker and monitor such an agreement. This could still allow them to raise funds for other candidates, which could further boost the party’s chances to retake the Senate and presidency. Kennedy raised $5 million for Democrats for the 2018 midterms and Markey raised $2 million over the past two years.

A spending cap could enable Democrats to ensure limited resources go to states like New Hampshire and Maine, where control of the Senate and the White House hinge amidst a presidency increasingly viewed as unhinged.

Call it doing more with less.

James Davitt Rooney is principal of Rooney Associates LLC.