Michael Bloomberg, billionaire and former Mayor of New York City, speaks at CityLab Detroit, a global city summit, on October 29, 2018 in Detroit, Michigan.

More than $166,000 in contributions, mailings and digital ads to help a political newcomer take on a Republican incumbent in a Richmond-area Senate district. More than $146,000 to help an Air Force veteran seek an open Senate seat in a fast-growing suburban county. About $75,000 to target the only Republican representing Northern Virginia in the state’s House of Delegates.

On Tuesday in Virginia, all three seats flipped from Republican to Democrat – after a $2.5 million spending spree in the state by Everytown for Gun Safety, a gun-control group aligned with billionaire former New York City Mayor Michael Bloomberg. The investments made the Bloomberg-affiliated organization the largest outside spender in the elections that saw Democrats take control of the state’s executive and legislative branches for the first time in a generation.

Everytown officials – who provided CNN with details of their Virginia strategy – say their approach to the off-year election demonstrates the potency of the gun-safety message one year before the nation heads to the polls to decide control of Congress and the White House. The spending also underscores how aggressively the deep-pocketed group will pursue its agenda in the months ahead. Everytown outspent the embattled National Rifle Association by roughly 8-to-1 in Virginia, plowing money into the state to target vulnerable Republicans months in advance of Tuesday’s election.

“Gun safety will be one of the defining issues of 2020,” said John Feinblatt, president of Everytown.

Virginia Republicans went into Tuesday’s election defending paper-thin majorities: 20-19 in the state Senate and 51-48 in the House of Delegates, with a vacancy in each chamber.

Everytown and the Democrats they backed made guns a key issue, following a mass shooting at a Virginia Beach municipal building on May 31 that left 12 people dead. The state’s Democratic Gov. Ralph Northam ordered a special session of the General Assembly in July to take up an array of gun-control bills, but the Republican leadership abruptly ended the session 90 minutes after it started without considering a single bill.

Even before the session began, Everytown strategists began polling to determine which Virginia races would be the most competitive in November should the General Assembly fail to act, said Charlie Kelly, a veteran Democratic strategist who works as a senior adviser to the group.

Soon after the adjournment, the group began a digital advertising blitz to target Republicans, particularly in suburban swing districts. “They made their choice to side with the gun lobby,” Feinblatt said.

Everytown’s spending came as the NRA faces intense scrutiny and legal battles with its former advertising agency. The gun lobby’s finances are under investigation by attorneys general in New York and Washington.

NRA officials this week said it’s not uncommon for Bloomberg-funded groups to outspend them in politics and insisted their membership ranks remained strongly committed to the gun-rights cause.