Republican Gov. Robert McDonnell of Virginia made no secret about who he thought should win Maryland's 2010 gubernatorial campaign. It wasn't Martin O'Malley.

Yet two months after O'Malley, a Democrat, sailed to victory, McDonnell showed up in Annapolis to attend the inauguration. Virginia's governor even praised the man he worked to defeat, calling O'Malley "a very smart guy" who "obviously had a record of accomplishments."

McDonnell's decision to extend the olive branch — and O'Malley's to take it — underscores a relationship between the two men that aides say has been cordial, even friendly at times. (O'Malley also attended McDonnell's inauguration a year earlier.)

Despite their deep ideological differences, occasional sparring on national television and the natural competition between the two neighboring states, the governors have been able to maintain a working relationship that rarely erupts in public spats. Advocates for various regional issues say their mutual respect has smoothed the way for agreements on transportation, emergency preparedness, crime reduction and Chesapeake Bay restoration.

The partisan pressure dividing them, however, is about to kick up a notch.

Last week, O'Malley was elected to head the Democratic Governors Association for a second year. McDonnell won his own full term as chairman of the Republican Governors Association two weeks ago, after filling out the end of Texas Gov. Rick Perry's tenure.

That means each man will lead his party's campaign organization going into 2012, when 11 gubernatorial elections are scheduled. Unlike this year, a good portion of those seats are considered highly competitive. Adding to the intrigue: O'Malley and McDonnell are both on their party's short list for national office and will want to impress party elders.

Jennifer Duffy with the Cook Political Report said it "does seem a little odd" that the two neighboring governors will be competing national voices for their parties in 2012. But she said it is "helpful" for the relationship that neither man is up for election this year — in fact, both are term-limited.

"They both have to live on their records, no matter what they do next," Duffy said. "It is in their best interest to keep [a cooperative relationship] going. It is also in the states' best interests, and both of them see that trumps politics."

In an interview, O'Malley described his relationship with McDonnell as "professional" and "collaborative."

"We have obvious differences of party and philosophy," O'Malley said. "But when it comes to governing, I try to cooperate whenever possible and I think that is what he tries to do."

McDonnell echoed the sentiment: "We are Potomac River border friends," he said in an interview. "We have a respect for each other. And we have some friendly competition."

McDonnell said that he and O'Malley have spoken about how their national roles could affect their interaction on regional issues.

"We will be out there competing and explaining our different vision for America," he said. "But we do know that on the issues that are important to the people of our state … we are going to be working together. I think we've already shown that."

The governors' cooperation hasn't produced a headline-grabbing accord such as the one between O'Malley and McDonnell's predecessor, Democratic Gov. Tim Kaine. Those two stood side-by-side on the banks of the Potomac River in 2008 to announce a ban on harvesting blue crabs in winter months, a development that is credited with a rebound in the population.

Still, O'Malley and McDonnell have produced concrete results, including an array of agreements centered on the health of the Chesapeake Bay. They hammered out consistent rules for how to determine when an oyster bed is considered restored. They've agreed on methods to monitor Bay water quality.

And, though the initial blue crab agreement was made with McDonnell's predecessor, environmental advocates and Maryland officials were relieved that Virginia's new Republican administration did not attempt to weaken to it.

"We get pressure every year to extend the harvest season," said Frank W. Dawson III, an assistant secretary at the Maryland Department of Natural Resources. "We're pleased that they have had the fortitude to stick with what we think is a really science-based decision."

Another high-profile display of cooperation occurs at regular meetings between McDonnell, O'Malley and Washington Mayor Vincent Gray on ways to improve Metro safety in the aftermath of a June 2009 Red Line accident that killed nine people.