Former Gov. Robert L. Ehrlich Jr., meanwhile, was eager to talk about an issue likely to energize his supporters.
"It's a fascinating scenario here," said Ehrlich, a Republican who is trying to win back the job he lost to the Democratic O'Malley four years ago. "Everybody acknowledges the federal government's failure to do one of its primary jobs, which is protect our borders. A state takes action. And then the federal government sues the state. It's a shame it has gotten to this point."
At issue is an Arizona law that will require police officers in that border state to determine the immigration status of suspects they have stopped for any reason, when they have a "reasonable suspicion" that the individuals are in the country illegally.
Supporters describe the law, scheduled to take effect this month, as a necessary response to the failure of the federal government to address illegal immigration.
Critics say it will lead to racial profiling. Attorney General Eric H. Holder Jr. announced a federal lawsuit last week seeking to block enforcement.
The debate enlivened the annual meeting over the weekend of the National Governors Association, where O'Malley was selected to lead a panel on homeland security with Republican Arizona Gov. Jan Brewer, and where O'Malley reportedly expressed apprehension over the lawsuit behind closed doors.
Several Democratic governors voiced concern about the political impact of the potentially unpopular lawsuit during what already is expected to be a difficult election year for their party, according to a report in The New York Times.
But on Monday, O'Malley said President Barack Obama had little choice.
"The president had to act because of events that he did not put into motion," he said after a labor rally campaign event in Annapolis. "I think when he does that, I think that we should respect that this is a matter of principle for him and that he's acting based on his principles."
Neither O'Malley nor Ehrlich has stumped about immigration on the campaign trail this summer, but analysts expect it to be a hot topic.
"I would be shocked if immigration and the Arizona law didn't come up in some context during the race," said Jennifer Duffy, who tracks gubernatorial contests nationwide as senior editor for The Cook Political Report. "Candidates of both parties across the country are reporting that voters are weighing in on the subject and want to know the candidate's position. It doesn't seem to matter whether these candidates hail from red, blue or purple states."
While the Mexican border lies more than 1,700 miles away, immigration issues have long inflamed Maryland politics.
State lawmakers have waged heated battles in recent years over whether to require motorists to show proof of U.S. citizenship when obtaining a driver's license and whether illegal immigrants who have graduated from public high schools here should be eligible for in-state tuition rates at public universities.
As co-chairman with Brewer of the National Governors Association committee on homeland security and public safety, O'Malley will be working on immigration issues with the most visible proponent of the Arizona law.
O'Malley has co-chaired the panel for a year with Republican Minnesota Gov. Tim Pawlenty, who is not seeking re-election. Aides to O'Malley said he has focused on security issues such as facilitating radio communications among emergency workers and local- and state-level information-sharing centers.
O'Malley's less-than-full-throated endorsement of the Justice Department lawsuit could reflect fear among Democrats that illegal immigration, a subject that arouses Republican bases, could distract voters from the subject Democrats would prefer to discuss this year: job creation.
Asked whether the lawsuit could affect him and the six other Democratic governors across the country seeking re-election, O'Malley didn't answer directly. Instead, he said he'd rather stay focused on jobs.
O'Malley serves as vice chairman of the Democratic Governors Association, so he might be particularly attuned to potential problems facing all of his counterparts seeking re-election, his campaign spokesman said.
Recent polls, including one released Monday by Rasmussen Reports, show O'Malley and Ehrlich in a statistical dead heat among people who say they are sure to vote this fall.
"This is going to be a challenging campaign in the most challenging of economic times," O'Malley said.
A June Rasmussen poll showed that 66 percent of Maryland voters support the Arizona law.
Ehrlich said immigration is one of the top half-dozen issues he hears about during his campaign stops. About a dozen supporters questioned him about the Arizona law and his stance on illegal immigrants during a recent Facebook chat his campaign organized.
Erhlich said he "welcomes the debate." While there are extreme views on immigration in both major political parties, he said, he believes most people see the issue as "you either respect the law or you don't."
Asked whether immigration buzz has surfaced at O'Malley's campaign events, campaign spokesman Rick Abbruzzese said, "Mostly we are hearing about anxieties people are having because of the economy."
O'Malley has called for "strong federal reform," Abbruzzese said. "We cannot ask our [local] law enforcement officers to play the role of immigration officers, on top of keeping our communities safe."