His name does not appear on the ballot, but Virginia Gov. Robert F. McDonnell’s final two years in office — and his political legacy — hinge on the outcome of Tuesday’s elections in Virginia.

The popular Republican governor has spent months calibrating an aggressive GOP strategy to take control of the state Senate, recruiting candidates to run, raising more than $5 million and appearing in dozens of campaign ads that have run in every region of the state.

If successful, Republicans will win complete control of the General Assembly — marking only the second time since the Civil War their party has simultaneously held the governor’s mansion, House and Senate in Virginia.

“If we win, they’ll say that’s another feather in his cap because he was able to win back the legislature,’’ McDonnell said in an interview in his office on Capitol Square. “Would it be nice to say we did it? Yeah, but you know what I care about more than that we did it — is what we do afterward, how can we govern better and get bigger things done.”

McDonnell has worked across the aisle during his first 21 months in office, largely on ­kitchen-table issues, including transportation and higher education. But he is frustrated that the Democratic-controlled Senate killed his proposals to expand the number of charter schools, reform the retirement system and divert existing money to ease traffic congestion.

A Republican victory would help McDonnell get his priorities passed, but it also could lead to a politically sensitive environment for a governor mostly regarded as a moderate who often works with both parties. The growing and more influential conservative wing of his party would want him to take on hot-button issues, such as gun rights, immigration and abortion, that he has largely avoided.

“If you have every part of state government go to one party, then those moderate voices on the Democratic side, or even on the Republican side, are gonna get drowned out,’’ said Sen. Mark R. Warner (D-Va.), who as governor persuaded a Republican legislature to approve higher taxes to pay for investments in education, public safety and health care. “I think what’s at stake here is more than just Democrats and Republicans. Is there gonna be a moderately responsible voice in Virginia government?”

Warner and another former governor — Timothy M. Kaine, who is a candidate for U.S. Senate in 2012 — are leading Democrats on a four-day sprint this weekend to encourage voters to keep the last bastion of Democratic power in Richmond.

McDonnell and fellow Republicans — Lt. Gov. Bill Bolling and Attorney General Ken Cuccinelli II — are appearing at 14 events in three days in every region of the state as part of their last sales pitch to voters.

GOP comeback

Virginia Democrats won a steady stream of elections, taking control of the state Senate in 2007 and, the next year, helping Barack Obama become their party’s first presidential candidate to win the state in more than four decades. Kaine, who as governor oversaw both those elections, declared “Old Virginny is dead” after the state turned its bluest in years in 2008.

But since then, Republicans have engaged in a steady march back to power. Their party controls most of Richmond, including the House of Delegates, and holds a commanding majority of Virginia’s congressional delegation.

“One of the things that made me feel great in 2007 was, with the Democrats winning the majority, we had a balance,’’ Kaine said. “Every Virginian — Democrat, Republican and independent — is going to be better off if there is some balance.’’

The spotlight is on Virginia in this off-year elections both because of its status as a swing state and because only three other states — Louisiana, Mississippi and New Jersey — are holding legislative elections.

Republicans have been trying to tie Democrats to an increasingly unpopular president, saying a Republican takeover of the Senate would be a rebuke of President Obama. But Democrats say if they hold onto the Senate majority, it will show that Virginians do not accept all of McDonnell’s policies, even though he has one of the highest approval ratings in the nation.

“It would show voters are rebuffing him and his influence,” said the retiring Sen. Mary Margaret Whipple (D-Arlington County).

McDonnell, who leads the Republican Governors Association and is often mentioned as a possible vice presidential candidate, is barred by law from seeking a second consecutive term and has said little about his plans.

“It’s important for McDonnell’s agenda — his legacy, if you will — to attain the Republican majority in the Senate,’’ said Jerry Kilgore, a former Republican state attorney general who ran unsuccessfully for governor against Kaine.

Democrats hold a 22 to 18 majority in the Senate. A two-seat loss would force the two parties to share, though Republicans would have an advantage because Boll­ing could cast a vote to break ties. A three-seat gain would mean Republicans would have outright control of the Senate for the first time since 2007.

‘Hard right turn’?

McDonnell, a self-described social and fiscal conservative, has largely governed as he campaigned — working to solve the state’s economic problems.

“Regardless of who wins the majority, I’m going to pursue the same things, but I’ll have a lot better chance on some of those things getting done,’’ he said.

McDonnell said he hopes a Republican Senate will help him reform the pension system, press the federal government to institute an energy plan that includes oil drilling off Virginia, and pass significant education reforms that would bring more accountability, merit pay and choice to schools.

But McDonnell also likely would be forced to decide whether to sign the type of conservative bills that have been largely championed by Cuccinelli and some House Republicans.

The Senate has always been considered the commonwealth’s more moderate chamber — even when the GOP controlled it — and Republicans there often disagreed more with the House, run by their own party, than with Democrats in the Senate.

Brian Moran, a former legislator who is chairman of the state Democratic Party, said a Republican victory would lead the General Assembly to take a “hard right turn,’’ with legislators focused on “God, guns and gays.”

Some of the Republican proposals that have died in past years and could return involve granting legal rights of personhood to fetuses, repealing Virginia’s limit of one handgun purchase per month, denying public assistance to illegal immigrants and calling for a convention to amend the U.S. Constitution to give states power over the federal government.

Bolling said he was frequently rankled that the Senate, despite its rules, killed some bills without giving them a hearing. He hopes that changes with a Republican Senate.

“You have bills that have not gotten a fair hearing,’’ he said. “The door has been slammed.”