The Virginia State Capitol building at night. (Tracy A. Woodward/The Washington Post)

The Republican Governors Association just wrote a $5 million check — the largest single political donation in Virginia’s history — with the goal of putting a Republican in the governor’s mansion.

The whopping contribution suggests Republicans like their odds in the commonwealth, one of just two states to hold governor’s races this year. But the structure of the donation would allow the RGA to take the money back if that outlook changes.

“We could end up spending none of it,” RGA spokesman Jon Thompson said.

Virginia has a popular Democratic governor, but Gov. Terry McAuliffe is banned by the state’s constitution from serving back-to-back terms. Four Republicans and two Democrats are running to succeed him.

“We see the Virginia governor’s race as a race that’s very vulnerable for party flip,” Thompson said. “We see it as a race that’s winnable. So we’ve started taking steps to do what we can.”

The contribution went to a political action committee the RGA controls, A Stronger Virginia, not to the state party or to any of the four Republicans seeking the nomination. So the RGA could pull the money out of Virginia if it later decides it is better spent elsewhere.

“A Stronger Virginia is a PAC we set up in order to possibly engage or spend in the Virginia governor’s race,” Thompson said in an email describing the PAC to the Virginia Public Access Project, a nonpartisan tracker of money in politics.

A spokesman for the Democratic Governors Association suggested the donation was meant to grab attention but not a firm bet on the race, given the RGA’s ability to take the money back.

“This is nothing more than a press release about paper shuffling between bank accounts,” said DGA spokesman Jared Leopold. “But the RGA does have good reason to be afraid about a field of out-of-touch candidates trying to force Donald Trump’s agenda on Virginia.”

The Virginia Public Access Project disclosed the record donation Friday. It is twice the size of the previous record: the $2.5 million the RGA gave to the Virginia Common Sense PAC in 2009. The next largest was a tie: $2 million that now-Sen. Mark R. Warner (D) gave his 2001 governor’s campaign; and the $2 million the DGA donated to McAuliffe’s 2013 race.

While the RGA’s $5 million broke the record for the largest single contribution, the RGA and other donors have cumulatively made bigger contributions in particular races. Over the course of the 2013 governor’s contest, for instance, the RGA gave $8 million to then-Attorney General Ken Cuccinelli II.

The Republicans running for governor are: Ed Gillespie, a former Republican National Committee chairman and counselor to then-President George W. Bush; Corey Stewart, chairman of the Prince William Board of County Supervisors; state Sen. Frank W. Wagner (R-Virginia Beach); and Denver Riggleman, the owner of a craft distillery.

The two Democrats running for governor are Lt. Gov. Ralph Northam and former congressman Tom Perriello.

The PAC will remain neutral in the Republican primary, Thompson said. But before both parties pick their nominees on June 13, Thompson said, the PAC might spend some of that money on ads against one or both Democrats.