The Virginia governor’s mansion in Richmond. (Steve Helber/Associated Press)

Virginia Lt. Gov. Ralph Northam had almost twice as much campaign cash available as rival Democratic gubernatorial candidate Tom Perriello two months ahead of the primary, according to data compiled Tuesday by the nonpartisan Virginia Public Access Project (VPAP).

Northam had $3.3 million available as of March 31, compared with Perriello’s $1.7 million. But Perriello, a former congressman and State Department official, has outraised Northam since his unexpected entry into the race in early January, taking in $2.2 million to Northam’s $1.4 million.

In the Republican primary field, Ed Gillespie maintained his commanding financial edge in the three-person contest, raising nearly $1.9 million, which, combined with earlier fundraising, left him with just over $3 million on hand.

Perriello’s haul was buoyed by several massive campaign contributions, with half of his money coming from four donors, while Northam was barred from fundraising during the 46-day General Assembly session that ended in late February.

Gillespie’s donors reflected his former role as a top-level Republican consultant, with 49 percent of his money coming from out of state. Former president George W. Bush, who attended a Dallas fundraiser for Gillespie, kicked in $25,000, and strategist Karl Rove gave $20,000. Edward St. John, a real estate executive and philanthropist from Baltimore who gives heavily to GOP candidates, was Gillespie’s top donor in the most recent period at $50,000. Gillespie reported about 3,600 donors in total.

Corey A. Stewart, the Republican chairman of the Prince William Board of County Supervisors, had a little more than $400,000 available after taking in and spending about $300,000 in the first three months of the year. Frank Wagner, a state senator from Virginia Beach who also is subject to the fundraising ban during a legislative session, reported that his campaign treasury dwindled to $178,000 after he raised just $58,000 and spent more than $250,000.

A fourth Republican candidate, Denver Riggleman, dropped out of the race in March, citing financial struggles. He raised about as much money as Wagner in the latest period and spent nearly all of it.

Voters can cast ballots in either major party’s June 13 primary.

Perriello drew big money from national Democratic donors, reflecting his status as an insurgent Democrat who is operating outside the Virginia party structure.

He launched his campaign Jan. 5 with $500,000 from Sonjia Smith, a Charlottesville resident who is a major donor to Democrats in Virginia and nationwide, and $200,000 from Avaaz, an international nonprofit group that funds progressive activists and was co-founded by Perriello a decade ago.

Philanthropist and liberal activist George Soros was Perriello’s second-most-generous contributor, at $250,000, and Soros’s son Alexander chipped in $125,000. New York financier Courtney Smith gave $75,000, while California philanthropist Stephen Silberstein donated $50,000.

Republican groups on Tuesday criticized Perriello for accepting the large donations, citing the candidate’s frequent bashing of Virginia’s system of unlimited campaign giving. A spokesman for Perriello said the largest donations come from people familiar with the candidate’s advocacy for progressive causes, not corporations or individuals with business before the state.

Perriello, who represented Southside Virginia and Charlottesville in Congress from 2009 to 2011, also picked up contributions from some of Charlottesville’s celebrities: $25,000 from best-selling author John Grisham and $12,500 from members of the Dave Matthews Band.

After the filing period, Perriello was endorsed by Sen. Bernie Sanders (I-Vt.) and the Our Revolution political group that grew out of Sanders’s failed presidential bid, providing access to a national donor network of progressive activists.

Overall, 57 percent of Perriello’s money came from outside Virginia, compared with 11 percent out-of-state donations for Northam, according to VPAP. Perriello reported about 5,200 total donors, compared with about 11,000 total donors for Northam in the latest period, according to VPAP’s analysis of the numbers.

Common Good VA, the political action committee formed by Gov. Terry McAuliffe to help Democrats running for office in Virginia, steered $100,000 to Northam days after Perriello announced his challenge. It was Northam’s largest donation in the most recent period.

Northam’s largest donor is Charlottesville-based financier Michael D. Bills, who gave a total of $200,000 and is married to Sonjia Smith — Perriello’s top donor.

Northam picked up funding from some big Northern Virginia and Beltway players, such as financier Ronald D. Abramson ($25,000) and longtime Democratic donors such as stockbroker Edward Hart Rice of Vienna ($20,000) and McLean activist Suzann W. Matthews ($30,000). Northam also scored $15,000 from Internet pioneer Vinton G. Cerf.

Both Perriello’s and Northam’s campaign fundraising falls far short of McAuliffe’s record haul of more than $5 million in the same period in the 2013 election cycle. The state constitution bars governors from seeking consecutive terms.

The gubernatorial campaign is expected to draw tens of millions of dollars because Virginia is one of only two states electing governors this year, and the election is seen as an early test of President Trump’s popularity.

In other Virginia races:

●In the Republican primary for lieutenant governor, state Sen. Jill Holtzman Vogel (Fauquier) increased her financial edge over state Sen. Bryce Reeves (Spotsylvania). Vogel had $550,000 to Reeves’s $450,000. Del. Glenn Davis (R-Virginia Beach), who is running a low-cost campaign based in his recreational vehicle, had about $31,000 left after lending himself $83,000.

●In the Democratic primary for lieutenant governor, lawyer and former federal prosecutor Justin Fairfax led the three-person field with $145,000 available. Former Democratic operative Susan Platt had about $100,000 available after a $20,000 loan from her husband, while former prosecutor Gene Rossi had $62,000, with nearly $50,000 in loans from himself and his brother.

●Attorney General Mark R. Herring (D) expanded his campaign fund to $1.4 million, while Republican John Adams ended the quarter with $560,000. Both candidates are uncontested in their primaries after Republican lawyer Chuck Smith did not qualify for the ballot.

The Republican Attorneys General Association donated $250,000 to Adams, the debut of its new strategy to target incumbent Democratic attorneys general in addition to competing in open races and supporting GOP incumbents.