Virginia Gov. Robert F. McDonnell labored to pass a conservative budget in the legislative session that ended last week, continuing to walk a fine line as GOP torchbearer while seeking to govern as a moderate. At the same time, he found himself trapped again in a battle over his party’s social values as Republicans rejected a gay nominee to a Richmond bench.

In Maryland, Gov. Martin O’Malley won a defining second-term tax increase , extending record funding for education. But in doing so, he laid down a new marker on the left in a nationwide debate over how much the rich should pay for government. Following his lead, Democrats voted to lower the definition of wealth and the threshold for those who will pay more in the state to anyone earning more than $100,000.

Washington’s two neighboring governors, term-limited and harboring national ambitions, had another thing in common last week, with ends to similarly rocky General Assembly sessions in Annapolis and Richmond.

Midway through their respective tenures, O’Malley (D) and McDonnell (R) — both national spokesmen for Democrats and Republicans — scuffed the boundaries of their parties as much as defined them.

“Both men will be remembered for this; it’s going to become part of the narrative for each of them, but for very different reasons,” said Jennifer Duffy, senior editor at the Cook Political Report. For O’Malley, the tax increase has pushed him left of left, she said. For McDonnell, on the right he will long be tied to conservative ideologues, on topics ranging from gay judges to vaginal ultrasounds that elicit visceral reactions among voters.

“McDonnell was sort of the leader of the party when it began to do some of these things that were out of the mainstream for Virginia. It may be part of his narrative if he is not chosen as [Mitt] Romney’s running mate, could this be part of the reason?” Duffy said. “For O’Malley, if he is as serious as his actions seem to suggest in running for president in 2016, this is one of those things that may not be a deal-killer in a primary, but my guess is his opponents would bring it up as evidence that he’s unelectable in a general election.”

For O’Malley and McDonnell, their rough-and-tumble legislative sessions, however, diverged in how willingly the two used the platform to push the envelope of their parties’ political mainstreams. While McDonnell seemed to struggle to moderate the most partisan efforts of his fellow Republicans, O’Malley more readily embraced a role as Democratic agitator.

Eyes on revenue

Already a proxy for President Obama in an election year, O’Malley’s legislative agenda began in January not only with a plan to make wealthy Marylanders pay more. He also proposed a progressive levy on residents’ water consumption; a near 20-cents-per-gallon increase in taxes on gasoline to expand road and transit construction; and a surcharge on electricity bills to subsidize development of offshore wind power.

Democrats overwhelmingly control Maryland’s General Assembly, but many of the governor’s plans went too far even for members of his own party. Neither chamber ever warmed to O’Malley’s gas-tax proposal, and a trio of African American lawmakers in the Senate quashed his offshore wind plan, saying it would cost residents too much.

O’Malley also threw himself into a renewed push to legalize same-sex marriage. In March, he and Democratic legislative leaders succeeded, signing a bill making Maryland the eighth state to allow gay nuptials.

If the session had ended there, gay marriage easily would have been O’Malley’s most recognizable accomplishment for the year.

But O’Malley lost his grip on the legislature’s budget negotiations. The Senate jettisoned his plan to raise revenue by whittling away deductions and exemptions for the state’s high-income earners. It instead approved an across-the-board income tax increase.

House lawmakers also became convinced that curbing deductions and exemptions might stifle home buying. They, too, approved a plan to raise income taxes, but limited it to six-figure earners.

O’Malley repeatedly said he preferred his plan to either of those, but after an unexpected late-session collapse in negotiations between House and Senate Democrats, he embraced the full-on income tax package as his own and helped broker a deal under which the assembly would return to Annapolis to approve it. In so doing, it flanked O’Malley’s six years in office with a second major tax increase. The governor pushed through a package of more than $1 billion in taxes, including a new set of progressive income tax brackets in 2007.

Maryland House Speaker Michael E. Busch (D-Anne Arundel) said he wasn’t convinced that the threshold of $100,000 for the latest increases would define O’Malley on the party’s liberal edge. Obama and prominent Democratic governors have set the bar higher for tax increases, generally on those making more than $250,000.

“Whether he has to explain it or not, I think when you are out there doing campaigning nationally, it’s still trying to protect the people on Main Street versus people who have done a little bit better,” Busch said.

O’Malley used the parlance of his 2010 reelection campaign when speaking to reporters last week to describe the tax increase as not a move left or right but “forward,” investing in the state’s future.

“I think the only comparison is success, success, success, for O’Malley,” said Maryland Senate President Thomas V. Mike Miller Jr. (D-Calvert), when asked about the legacy of the past year for O’Malley and McDonnell.

“I mean, they’re both lame ducks. . . . I don’t mean to sound overly partisan, but O’Malley seemed to get what he wanted from the General Assembly and McDonnell didn’t.”

Social issues

Virginia’s General Assembly wrapped up its work for the year with a 13-hour session that for McDonnell was part smack-down, part victory — and entirely overshadowed by an unwelcome return to headline-grabbing social issues.

The governor and lawmakers completed work on the budget, but it was the legislature’s debate and rejection of an openly gay man nominated for a Richmond judgeship that again drew nationwide attention. Conservatives rejected Tracy Thorne-Begland, a veteran prosecutor with a tough-on-crime reputation but who had also challenged the military’s now-defunct “don’t ask, don’t tell” policy.

The controversy not only eclipsed completion of the budget, but also put McDonnell on the spot with the sort of social issue that he sought to downplay as governor — particularly this year. McDonnell had kicked off the year urging Republicans, who had control of both chambers and the governor’s mansion for only the second time since the Civil War, not to overreach.

As the popular leader of a key swing state, one that was riding out the recession relatively well, McDonnell was often mentioned as a Republican vice presidential prospect. He established solid conservative bona fides as a state delegate and attorney general, but as governor a focus on less ideological issues — job growth and economic development — could play well with independent voters.

Conservative Republicans brought out a raft of bills that for years had died at the hands of Senate Democrats and moderate Republicans. Among them was a measure requiring that women undergo an ultrasound before having an abortion. In the earliest stages of pregnancy, when most abortions occur, the ultrasound would require a vaginal probe.

McDonnell said he would sign the legislation but then backed off after the measure was decried by cable commentators and lampooned by “Saturday Night Live.” He worked to soften the measure by requiring only external ultrasounds.

Amid the firestorm, McDonnell worked behind the scenes to kill the “personhood” bill, which would have given rights to a fertilized egg.

Some conservatives felt betrayed.

“He is clearly putting on the brakes on a number of things,” said Del. Robert G. Marshall (R-Prince William), who authored the personhood legislation and led the opposition in the House against Thorne-Begland.

But Del. David B. Albo (R-Fairfax) gave McDonnell credit for stepping in on the ultrasound bill.

“I think he did show leadership there to try to get something that was more acceptable,” he said. “I think people want compromise in government.”

McDonnell took a similarly middle-of-the-road stance last week as conservatives blocked Thorne-Begland’s appointment. The governor issued a statement that denounced discrimination in judicial appointments, but stopped well short of saying that bias played a role in his rejection.

The statement came off as mealy-mouthed to some on the governor’s left and right, either because they wanted him to condemn the vote or defend it.

“There’s blatant discrimination happening on the floor of the House,” said Sen. A. Donald McEachin (D-Henrico). “You’re the governor. You can’t take a pass.”

Time will tell which governor’s session has the most lasting impact. But Bob Roberts, a James Madison University political scientist, said that he thinks McDonnell’s plays worse, for now.

“Everything had gone [McDonnell’s] way; he didn’t want social issues and he let it get away from him,” Roberts said. “I think O’Malley’s behavior is more consistent with O’Malley: He may be a little ahead of his party — push ahead, go for more than you’re gonna get.”