Democratic gubernatorial candidate Lt. Gov. Ralph Northam greets people during a visit to a Burke farmers market Saturday. (Salwan Georges/The Washington Post)

More doorbells will be rung, phones called and text messages sent this weekend than any contest for Virginia governor has ever seen, according to Republicans and Democrats mounting a mammoth final push ahead of Tuesday's election.

And the campaigns are on track to spend a record amount of money in the statewide races for governor, lieutenant governor and attorney general, much of it coming from groups outside Virginia battling for a win with national implications.

In the end, a race whose outcome will be cast in epic terms — a referendum on the presidency of Donald Trump, the fates of both major parties in the balance — will turn on the simplest of factors: who shows up to vote.

Democrat Ralph Northam's campaign says it is fielding a historic army of staffers and volunteers who are working three times as many shifts and making more than twice as many calls and home visits to get out the vote than on the same weekend during the 2013 governor's race.

Republican Ed Gillespie and his campaign had already knocked on doors 2.7 million times heading into the weekend and were expected to reach about twice as many as in 2013, said Garren Shipley, Virginia spokesman for the Republican National Committee.

Polling suggests that Gillespie and Northam are in a dead heat. Libertarian Cliff Hyra is running in the single digits but could play the spoiler in a close race.

Gillespie campaigns at Accotink Academy in Springfield on Saturday. (Astrid Riecken/For The Washington Post)

The final, frantic efforts suggest the stakes involved. A Northam loss would be seen nationally as a catastrophic failure by the Democrats. Virginia almost always elects a governor of the opposite party from the president, and Trump is deeply unpopular in the state.

But that holds only if Democratic voters show up at the polls. Northam has been criticized for running a lackluster campaign and for not devoting enough resources to woo African American voters in particular, who make up 20 percent of the electorate and have powered recent statewide wins for Democrats.

Republicans, on the other hand, are burning to deliver such a demoralizing blow to Democrats and show that Trump is not a liability in swing states. A victory would give Republicans full control of the state government, and the next governor will oversee redistricting, which could cement that control for years.

The candidates themselves were barnstorming through the weekend. Northam scheduled at least 15 appearances between Friday and Sunday, and Gillespie had six.

Northam started with a Saturday morning rally in Annandale with hundreds of union canvassers — including teachers, plumbers, carpenters and firefighters. "We cannot take anything for granted," Northam roared in his speech to the crowd.

Virginia general election guide

He then swung by a farmers market in nearby Burke to shake hands with shoppers, coo over babies and trade details of military service with fellow veterans.

Renate Wood, pushing her baby, Oliver, in his stroller, shook hands with Northam and later said she was voting for him because of a string of negative ads Gillespie has been airing since September.

"My child is only 16 months, and I have to turn the TV off when commercials come on," Wood said. "It's gone too far, and it needs to stop."

Meanwhile, in a Springfield school parking lot, Gillespie was flanked by Maryland Gov. Larry Hogan (R) and former Virginia governor George Allen (R), who urged about 50 enthusiasts to knock on doors and call friends and neighbors.

Carly Fiorina, the former Hewlett-Packard chief executive who ran in the GOP presidential primaries last year, also appeared and called Gillespie "a decent man of deep substance."

"This isn't a guy who's thrown dirt throughout this campaign," she said, ignoring the negative ads the Republican ticket has produced and aired. "We could not do better than Ed Gillespie as governor of Virginia."

Gillespie's ticket-mates, state Sen. Jill Vogel (R-Fauquier), the lieutenant governor nominee, and John Adams, candidate for attorney general, were also on hand.

But the biggest draw seemed to be Hogan's wife, Yumi. After the rally, the South Korean-born first lady of Maryland instantly drew a big contingent of fans who sought a photo with her, and eventually with Allen, as well. The candidates, who had left the stage and ducked into the Accotink Academy school, didn't attract nearly as many fans.

Donations from outside groups make up half of all funds raised by Northam and Gillespie, according to an analysis by the nonpartisan Virginia Public Access Project. And those groups are also putting feet on the ground this weekend.

Look Ahead America, a group of veterans of Trump's presidential campaign, plans to spend the homestretch nudging disaffected, rural, blue-collar Virginians to the polls.

Look Ahead is reaching out to 12,000 registered voters who have not gone to the polls since 2009, the last year Republicans won statewide, through direct mail, phone calls, robo-calls, emails, social media and door knocking.

The National Rifle Association and the anti-tax group Americans for Prosperity also will knock on doors to try to rally conservative voters, although officials with those groups did not offer specifics.

On the Democratic side, the Virginia League of Conservation Voters will have 300 organizers in the field on Election Day reminding people to vote in the Richmond and Hampton Roads areas. BlackPAC, a newly formed political action committee devoted to turning out black voters, will be sending get-out-the-vote text messages to 50,000 African American voters and deploying 50 canvassers, also in Hampton Roads.

NextGen America, an organization founded by California billionaire Tom Steyer that focuses on turning out millennial voters, will have nearly 1,600 volunteers working to get college students to polling places on 17 campuses with a variety of events, including a petting zoo on the Virginia Tech campus that lures students with the appeal of baby animals and steers them to polling places.

Planned Parenthood's political arm is also launching canvasses in Alexandria, Chantilly and Virginia Beach on Election Day, and operating phone banks throughout the state. CASA in Action, a Latino advocacy group, said it will have knocked on 50,000 doors by Election Day in Hispanic neighborhoods in the D.C. suburbs, as well as texting more than 20,000 voters.

Besides the statewide races, all 100 seats in the House of Delegates are on the ballot. While Republicans have a 66-34 advantage in the legislative body, Democrats have fielded a historic number of challengers and are hoping at least to gain some seats.

Virginia's off-year elections are generally ghostly affairs, often with less than half the electorate showing up. There are signs that this year might be different.

The contest has set a record for absentee voting. The more than 147,000 absentee votes cast as of Friday night is the most for a nonpresidential year in Virginia history.

In the rural southwest part of the state, where Gillespie is counting on a big edge, absentee voting is up compared with the 2013 governor's race. But that increase is below the state average, and a smaller gain than in many of the more populous parts of the state, according to an analysis by VPAP.

But all recent Virginia governor's races have been decided by very close votes, and this year's is especially hard to predict — partly because it's unclear whether national politics will motivate voters to cast ballots or stay home.

Trump, who has cast a long shadow over the race, left for a trip to Asia on Friday without appearing in the state to campaign. Gillespie reacted gingerly last month when Trump issued several tweets urging Virginians to vote for him.

His Trump strategy has evolved since the spring, when Gillespie nearly lost the GOP nomination to Prince William County's supervisor, Corey Stewart, who wholeheartedly embraced Trumpism. Stewart aimed his campaign at rural and blue-collar white voters and campaigned on protecting Confederate monuments and fighting illegal immigration.

Gillespie has tried to avoid reacting to the daily barrage of Trump controversies, largely bypassing the mainstream press in favor of appearances before friendly groups he can later trumpet on social media.

But from his initial emphasis on the economy and taxes, Gillespie steered toward illegal immigration and Confederate statues — a strategy that polling suggests helped him firm up support among conservatives.

Northam's campaign has concentrated largely on the state's population centers, where a more diverse electorate has helped Democratic candidates win recent statewide races. The urban crescent from the D.C. suburbs through Richmond to Hampton Roads helped Virginia become the only Southern state last year to back Hillary Clinton.

Criticized by some within his own party for being too low-key, Northam has run an almost old-fashioned campaign of promising bipartisanship and emphasizing his background as a doctor and state legislator. He has said he would continue popular policies of outgoing Gov. Terry McAuliffe (D), including expanding the state's economy and resisting Republican efforts to limit gay rights and abortion.

But Northam also has drawn the ire of some environmental groups for refusing to condemn two natural gas pipelines planned in rural parts of the state. And he has sometimes struggled to balance his own competing interests.

Northam responded to the racial violence of Charlottesville by promising to lead a campaign to remove Confederate statues, then reverted to his original stance that decisions should be made locally. He has blasted Trump as a "narcissistic maniac," then promised to work with him when it's in Virginia's interest. And he has condemned Gillespie's TV ads that link immigrants with Hispanic street gangs as fearmongering but stood by an ad from a Latino group that depicted a white Gillespie supporter stalking brown children.

The trick for Northam is to bring out huge support from African American and other minority voters while also attracting suburban whites. Gillespie, meanwhile, needs a strong showing from Trump voters as well as help from moderates and independents.

Patricia Sullivan contributed to this report.