GOP gubernatorial candidate Ed Gillespie, left, had nearly twice as much cash on hand at the end of June as his Democratic rival, Lt. Gov. Ralph Northam. (Bill O'Leary/The Washington Post)

Ralph Northam’s decisive win in Virginia’s Democratic gubernatorial primary in June took a big toll on his war chest, leaving him with just $1.75 million on hand — about half as much as Republican candidate Ed Gillespie’s $3.2 million, according to campaign finance numbers released Monday.

Northam, the state’s lieutenant governor, raised nearly $2 million in June, bringing the total amassed for his bid to $9.4 million.

But his hard-fought primary that month against former congressman Tom Perriello consumed all but $1.75 million of the haul, according to campaign finance records.

Northam beat Perriello by nearly 12 points.

Gillespie, a former Republican National Committee chairman and adviser to President George W. Bush, raised $1.8 million in June, bringing his total over the campaign cycle to about $6.7 million.

Gillespie spent about $3.5 million through June 30, a period that includes the two weeks following the June 13 primary, while Northam spent $7.7 million.

Polls and political analysts suggested Gillespie would easily beat Prince William Board of County Supervisors Chairman Corey A. Stewart, who ran as a President Trump-style provocateur, and state Sen. Frank W. Wagner (Virginia Beach), whose promise to raise taxes for transportation never got traction.

But Stewart nearly upset Gillespie, finishing just 1.2 points behind him.

The close call has caused senior Republicans from the White House on down to question Gillespie’s campaign strategy and team.

But there was a silver lining to underestimating Stewart: Gillespie still had $3.2 million in the bank as of June 30.

Cliff Hyra, the Libertarian candidate for governor, raised $2,979 in June, bringing his total to just under $31,000. He had $3,492 in the bank at month’s end.

Perriello raised about $506,000 in the final month, including a $150,000 loan he made to his own campaign days before the primary. That brought the total raised for his effort to about $4.6 million. A State Department official under President Barack Obama, he had $26,000 in the bank at the end of June.

Stewart raised $81,000 in June, boosting the total raised for his bid to just over $1 million. He ended the month with $9,264 in the bank.

Wagner raised in $92,000 in the final month, for a total of $736,000. He ended June with just $338 on hand.

In the race for attorney general, incumbent Mark R. Herring (D) raised $526,000 between his campaign account and his One Commonwealth PAC. That brought the amount he has collected since assuming office in January 2014 to $3.3 million. Herring, who had no primary challenger, had $2.5 million in the bank at the end of June.

His Republican challenger, John Adams, raised $234,000 in June, bringing his total haul to $1.5 million. A prominent Richmond attorney and former federal prosecutor, Adams had no competition for the GOP nomination after one rival dropped out and another failed to make the ballot. He had $683,969 in the bank at the end of June.

In the race for lieutenant governor, Democrat Justin Fairfax raised about $188,000, for a total of about $1.3 million. After a three-way primary, he had about $71,000 available heading into July.

His GOP opponent, state Sen. Jill Holtzman Vogel (Fauquier), raised $147,000 in June, for a total of $1.8 million. She ended the month with $87,000 on hand.

In House races, some of the most high-profile Democratic candidates were also the best fundraisers.

Danica Roem, a former journalist who would be Virginia’s first openly transgender state lawmaker, raised nearly $86,000 in June, more than any other Democrat, in her bid to unseat Del. Robert G. Marshall (R-Prince William), one of the legislature’s most vocal conservatives. That brings the total she has raised for her bid to about $152,000. Marshall raised just under $4,600, for a total of about $62,000.

Chris Hurst, a former Roanoke news anchor whose girlfriend was fatally shot during a live broadcast, raised nearly $60,000 in June, for a total of $231,000 — the largest campaign war chest of any non-incumbent Democrat. Hurst is vying to unseat Del. Joseph R. Yost, a Republican who represents a Southwest Virginia district that includes Virginia Tech. Yost raised $44,000 in June, for a total of $167,000.

Del. M. Kirkland Cox (R-Colonial Heights), who is set to be speaker if Republicans retain their majority, and Del. S. Chris Jones (R-Suffolk), chairman of the House Appropriations Committee, were the top fundraisers for the month.

Jones raised $129,000 in June, for a total of $789,000. Cox raised $112,000 in June, on top of $265,000 raised between his Majority Leader and Colonial Leadership Trust political action committees since April.

Republicans currently enjoy a 66-34 majority in the House. Since losing the primary, Perriello has been leading Win Virginia, a new PAC that is trying to help Democrats win enough seats to become the majority parity. He announced Tuesday that in June, 22 of the 54 Democrats running for delegate had outraised their Republican opponents, 21 of whom are incumbents. Many of those Republicans still had more money in the bank, however.