One of the most hotly contested Senate races is for the seat being vacated by retiring Sen. Charles J. Colgan (D-Prince William), pictured in 2012. (BOB BROWN/AP)

Two Virginia Senate races will determine whether Gov. Terry McAuliffe (D) finds a sorely needed foothold on Capitol Square, and Republicans and Democrats are betting big money on both.

The contests — which will decide control of the Senate and McAuliffe’s prospects for a legislative legacy — are for seats being vacated by two of the Senate’s last moderates: Sen. Charles J. Colgan of Northern Virginia and Sen. John C. Watkins of suburban Richmond.

Colgan (D-Prince William) and Watkins (R-Powhatan) are part of the dwindling Senate old guard that prized pragmatism over partisanship. Both bucked their own parties at times — and got away with it in districts that tolerated, and perhaps prized, their independent streaks. That is partly why both parties see an opening in those races, despite the fact that the districts have gone blue in recent statewide races.

Donors poured a total of $3.6 million into the races through last month, with more on the way. The intensity of the fundraising reflects the political stakes for McAuliffe — and Republicans intent on blocking his agenda — as the term-limited governor approaches the halfway point of his four-year stint. The elections will speak not only to the governor’s power to push priorities through the legislature, but also to his ability to deliver Virginia for Hillary Rodham Clinton, a close friend, as she seeks the presidency.

All 140 General Assembly seats are up for election in November. But given the GOP’s wide majority in the House, most of the money and attention have been directed to the Senate, where the GOP has a narrow 21-19 advantage. Democrats only have to pick up one seat to take control of the upper chamber because Lt. Gov. Ralph Northam (D) has the power to break most tie votes.

Only a handful of Senate seats are being hotly contested, with the Colgan and Watkins seats widely seen as most up for grabs.

“What’s really striking about the battle for control of the Virginia Senate is how few races could even plausibly be discussed as competitive,” said Stephen J. Farnsworth, a University of Mary Washington political scientist. “It is a testament to the effectiveness of gerrymandering.”

The race to succeed Colgan pits Manassas Mayor Harry J. “Hal” Parrish II (R) against Democrat Jeremy McPike, who works for the city of Alexandria.

The district — which includes part of Prince William County, Manassas City and Manassas Park City — reliably elects Democrats to statewide offices. But Republicans see an opportunity in a district that has long supported Colgan, a Catholic who opposes abortion and crossed party lines to help Republicans pass the 2012 budget.

Colgan, who is retiring after four decades, is a former World War II pilot and founder of the regional airline Colgan Air. Unlike Watkins, Colgan has not formally endorsed his party’s nominee.

Parrish, an Air Force veteran and the owner of Manassas Ice and Fuel, hopes to follow his late father to the General Assembly. As chairman of the powerful House Finance Committee in 2004, the elder Parrish was one of the Republicans who helped then-Gov. Mark R. Warner (D) pull off a $1.6 billion tax increase. The legislative victory catapulted the Democrat to national prominence and divided the GOP, which still bears the scars of the deal at a time when compromise is a dirty word among hard-core conservatives.

Parrish says he probably would have voted the same way. “He did it because he thought it was the right thing, not because of a political motive,” he said of his dad.

On a sunny October day, the soft-spoken Parrish went door to door in Prince William with a simple message: “I’m doing politicking the old-fashioned way.” Parrish said he was most proud of getting Baldwin Elementary School built, even though the project required a tax increase.

McPike, a Dale City volunteer firefighter and emergency medical technician, has played up some liberal causes, such as abortion rights, gun control and the expansion of Medicaid under the Affordable Care Act. But like Parrish, McPike has emphasized bread-and-butter issues such as transportation and education in the suburban district.

McPike hopes TV commercials showing him stuck in traffic behind the wheel of his Hyundai Santa Fe will connect with voters frustrated by long commutes into Washington.

“A lot of people drive the same areas and see the same bottlenecks,” he said.

Hoofing it around a subdivision in the rain one evening last week, McPike handed out business cards with his personal cellphone number and looked for common ground among young families with children like his. He spoke of reforming standardized tests, which he said can be overwhelming for students.

Both parties are flooding the districts with cash. McPike raised $740,000 through September and Parrish has pulled in $895,000, according to data compiled by the Virginia Public Access Project.

Even more money has poured into the race to succeed Watkins. Democrat Dan Gecker raised $1.2 million through September and Republican Glen Sturtevant took in $772,000.

The territory they seek to represent is Virginia in miniature: capable of swinging, but not because it is full of middle-of-the-road voters. It has deep blue sections of urban Richmond, including precincts that last year backed Warner for U.S. Senate by margins as high as 94 percent, and deep red stretches of rural Powhatan, with precincts that went for Warner’s Republican rival, Ed Gillespie, by 77 percent. In between are Republican-leaning chunks of suburban Chesterfield.

The district includes larger swaths of the city than when Watkins first took office in 1998, so overall it tilts blue in statewide races. Warner won it, as did McAuliffe in 2013 and President Obama in 2012. As the district changed, Watkins held on by dint of personal popularity and moderate voting record. He was one of just three Senate Republicans to support a form of Medicaid expansion.

Watkins is a nurseryman and chairman of Essex Bank who served in the House for 16 years before joining the Senate. The two men vying to succeed him say they would follow in his moderate, pro-business footsteps. In some ways, both play against partisan type.

It’s the Republican lawyer in the race who lives in the city, serves on the Richmond school board and highlights his racially diverse family. (He and his wife are white and have three young adopted children. One child is white, and two are African American.)

The Democrat, a Chesterfield County supervisor, is an lawyer-turned-developer who once represented Kathleen E. Willey, the White House volunteer who accused President Bill Clinton of groping her in the Oval Office in 1993. He also considers Ronald Reagan a political hero — albeit for his communication skills, not his politics.

Both candidates emphasize kitchen-table issues such as economic development and education. But sharp ideological differences were on display last week as they appeared at a candidate forum.

“I do not support expanding Obamacare,” Sturtevant said flatly when asked about Medicaid, saying that the fast-growing program was crowding out core functions of government. Gecker, meanwhile, called expansion of health care for the poor “a moral issue as much as anything else.”

Sturtevant emphasized the need to reduce tax and regulatory burdens on businesses. Virginians, he said, must “keep more of what we earn.” Gecker called for raising the minimum wage, saying, “It’s clear we need to do something to lift people up.”