Maryland Gov. Martin O'Malley and Virginia Gov. Bob McDonnell weren't on the ballot in Tuesday's elections, but their political futures were on the line, and O'Malley may have come out the big winner.

McDonnell and O'Malley each led their parties' governors association and served as high-profile surrogates for their presidential nominees, in addition to fighting for their own priorities on the state ballots, prompting speculation that both were nursing national political ambitions.

By the time polls closed, O'Malley was four-for-four, with voters approving his Democratic social agenda and backing the expansion of gambling he sought. McDonnell didn't do nearly as well.

"I've never been so relieved by an election outcome that I haven't been on the ballot for," O'Malley told The Washington Examiner. "It was a very positive night, very exciting night, and I hope a night that creates even more momentum nationally" for same-sex marriage and immigration reform.

Unlike dependably Democratic Maryland, where President Obama's success was never in doubt, McDonnell worked for months on behalf of Republican presidential nominee Mitt Romney in a state that was once reliably Republican but is now a tossup. Obama won the state in 2008, but McDonnell led a Republican sweep the very next year.

In the end, McDonnell could only watch as Virginia again backed Obama, the first time since 1948 that the state supported a Democrat in back-to-back presidential elections.

McDonnell's pick for an open U.S. Senate seat, Republican George Allen, also lost, helping to dash Republican hopes of taking over that chamber.

"This was certainly a setback after three very good years of Republican gains in Virginia," McDonnell told The Examiner. "We've had a pretty good run in Virginia, but certainly this was the biggest of all elections."

Virginia Democrats said McDonnell is partially to blame for Republican failures, citing his signing of legislation requiring women to undergo an ultrasound exam before getting an abortion.

"It was like a big anchor on the Republican side, so extremely unpopular with suburban and educated women," said Del. Mark Sickles, D-Franconia. "It was just one more thing they had to overcome in the election."

Despite the election results, neither O'Malley's nor McDonnell's fortunes may have changed much on election night, according to University of Mary Washington political scientist Stephen Farnsworth.

"Both governors end this election cycle about where they began: the second tier of potential presidential nominees," Farnsworth said. "They'll be taken seriously if they run. But there are people a few steps ahead of them in the [next] race."

Until Tuesday, McDonnell appeared to have the upper hand in the cross-state rivalry. Unemployment remained lower in Virginia, and McDonnell's anti-tax, pro-business agenda was credited.

McDonnell, head of the Republican Governors Association, also scored a victory over O'Malley, head of the Democratic Governors Association, this summer when Wisconsin Gov. Scott Walker staved off a recall attempt fueled by O'Malley's group. Republicans also picked up an additional governor's seat Tuesday for a total of 30.

O'Malley, however, scored two major victories for the Democratic agenda when Maryland voters approved same-sex marriage and the so-called Dream Act, which gives college tuition breaks to the children of illegal immigrants. Voters also blessed a redistricting map that expanded Democratic influence in the state and a new casino in Prince George's County, two more of O'Malley's priorities.