Maryland Gov. Martin O'Malley shakes hands with Ben Guise of Des Moines as he meets with Iowa Democratic Party volunteers Saturday, June 21, 2014, during a canvass kick off event at Saints Pub + Patio in Des Moines. (Scott Morgan/For The Washington Post)

Maryland Gov. Martin O’Malley, a stalwart ally of President Obama, has landed in an escalating fight with the White House over what to do about thousands of unaccompanied children streaming across the U.S. border.

It started Friday, when O’Malley declared that returning the children to their home countries, as Obama has suggested, would send them “back to certain death.” That prompted an angry response from White House officials and accusations of hypocrisy when O’Malley opposed locating a shelter for the children in a Maryland county.

But the Democratic governor, who is considering a bid for president in 2016, did not budge from his position in interviews Wednesday.

“We are Americans, and we do not return refugee kids who find themselves on our doorstep back into war-torn or famine-racked places where they will face certain death,” O’Malley said. “I think we have to act like Americans.”

The White House has regularly turned to O’Malley to help promote Obama’s positions on the talk-show circuit, particularly when O’Malley served as chairman of the Democratic Governors Association. The former Baltimore mayor’s decision to publicly disagree with Obama on a thorny issue of immigration appears, at least in part, to be a calculated step that positions him to the left of other potential contenders for the Democratic presidential nomination.

This empty Army reserve warehouse in Westminster, Md., is on the list of possible sites to house undocumented minors who illegally cross the border into the United States. The building recently was hit by by vandals. (Jenna Johnson/The Washington Post)

But it also comes with some peril — not only by provoking a conflict with the president, but also by putting O’Malley on the defensive about his objections to a federal proposal to open a shelter for some of the children in Carroll County. The proposal involved a former military center that was marred by anti-immigration graffiti over the weekend, and O’Malley said he worried that the children would be unwelcome.

The conflict made clear that, despite O’Malley’s passionate rhetoric, the immigration issue poses for him some of the same challenges and political complexities that it does for Obama on the national landscape.

On Wednesday, White House press secretary Josh Earnest agreed at a news media briefing that the children should be treated humanely and given due process, but he maintained that complicated federal law needs to be more efficiently enforced.

“There is widespread recognition among members of both parties that we’re dealing with a serious situation at the southwest border, that these are thorny policy problems,” Earnest said.

Meanwhile, activists praised O’Malley for remarks made Friday during a Democratic Governors Association news conference in Nashville, where he spoke passionately about the plight of unaccompanied immigrant children from countries such as Guatemala and Honduras.

“Thank God, we might be at a moment where a [potential] presidential candidate understands what is happening and takes a stand,” said Kimberley Propeack, the senior director of politics and communications for CASA of Maryland, which advocates for low-income immigrant communities. “We are proud of the governor.”

During the news conference Friday, O’Malley — joined by the governors of Connecticut and Vermont — set forth a point of view that surprised some of his Democratic colleagues. That outlook, he said, was shaped by his forebears, including a great-grandfather Martin O’Malley who immigrated to the United States from Ireland, and by the social justice mission of the Catholic Church.

Sudden surge in unaccompanied children at border

“I can only imagine, as a father of four, the heartbreak that those parents must have felt in sending their kids across the desert where they could be muled or trafficked or used or killed or tortured, but with the hope that they would reach the United States,” he said.

O’Malley’s stand on immigration shouldn’t come as much of a surprise.

During his two terms as governor, Maryland lawmakers approved a state-level “Dream Act” that provides instate college tuition rates to some undocumented immigrants. The state also extended the ability to obtain driver’s licenses to undocumented immigrants — or, as O’Malley calls them, “new Americans.”

And in April, the governor announced that a state-run jail in Baltimore would no longer automatically follow federal government orders to hold immigrants for possible deportation, an act of defiance that did not garner nearly as much attention.

This time, the reaction from the White House was immediate. Within hours of his comments Friday, O’Malley received a phone call from Obama’s domestic policy director, Cecilia Muñoz, the governor said. He wouldn’t comment on her tone, but aides described it as frustrated.

In addition, details were leaked to the media about a request from O’Malley during the conversation that children not be sheltered at the former Army Reserve Center in Westminster, a city of about 18,600 that’s about 35 miles northwest of Baltimore in Carroll County.

The request, first reported by CNN, was cast by a “Democratic source” as evidence of O’Malley’s hypocrisy: The governor did not want the children returned to their home countries, but he resisted sheltering them in his own state.

O’Malley aides were incensed, feeling that the governor’s comments were misconstrued. They said that O’Malley has been working closely with the White House for weeks to find safe accommodations in Maryland. On Monday, state officials began to process paperwork to secure more foster-care providers for the children.

“We’ve had many conversations,” O’Malley said of Muñoz on Wednesday, “but this is the one that she chose to leak.”

But the governor confirmed that he raised concerns with Muñoz about opening a shelter in Carroll County — a conservative stronghold in a mostly Democratic state. Last year, county leaders voted to make English the official language, despite protests that such an action was unwelcoming to immigrants.

“I suggested to them that the location still under consideration in Westminster might not be the most inviting environment for the kids,” O’Malley said.

O’Malley said his concerns were confirmed over the weekend when graffiti appeared at the vacant military center: the misspelled “No illeagles here” and “No undocumented Democrats.” Maryland State Police are investigating the graffiti as a hate crime.

The federal government is no longer considering the Westminster location, an administration spokesman said.

Earnest, the White House press secretary, confirmed at Wednesday’s briefing that Muñoz and O’Malley had spoken, but he declined to discuss the conversation. A White House spokesman did not respond to a request for a comment from Muñoz.

O’Malley said that the best arrangement for the children is with relatives living in the United States. If a child does not have family, then a foster home or other temporary housing should be an option, perhaps tapping the generosity of churches. Large shelters, such as the one proposed in Westminster, would be difficult to set up, he said.

“I will continue to work to alleviate the humanitarian crisis,” O’Malley said. “And I think every governor and every mayor in America, and every American citizen, has some responsibility and role to play here. It’s who we are as a people.”

Dan Balz and David Nakamura contributed to this report.