Maryland Gov. Martin O'Malley says he would sign a law legalizing civil unions if lawmakers pass the legislation next session.

Legalizing civil unions would give same-sex couples certain tax benefits enjoyed by opposite-sex couples -- though the unions still would not be recognized for federal tax purposes, O'Malley spokesman Shaun Adamec said.

Maryland recently began allowing state employees with same-sex spouses to enroll for health benefits following a February mandate from Attorney General Douglas F. Gansler that all state agencies begin recognizing out-of-state gay marriages.

"We will be guided by the attorney general's decision," O'Malley said in a Thursday radio interview. "I think the way to move forward is around civil unions."

Adamec said he expects lawmakers to draft legislation next session legalizing the unions. He said the law would specify for which tax breaks same-sex couples would qualify.

Bob Ehrlich, O'Malley's opponent in the Maryland governor's race, has said he does not support civil unions. The Republican supports allowing only "nontraditional" couples to make medical decisions for each other, said Ehrlich spokesman Andy Barth.

O'Malley took aim at another hot-button issue, reinforcing his support of the Obama administration's lawsuit against Arizona for its newly enacted immigration law -- which requires police to question a person's immigration status if they suspect the person is in the country illegally.

In Maryland particularly, he said, "We cannot substitute for lack of federal enforcement by turning all of the municipal, county and state police into a giant immigration service. ... Nor do we have the money to create large detention camps to hold people until they can prove their citizenship."

Frederick County became the first and only jurisdiction in Maryland to enforce the federal287(g) in 2008.

Frederick Sheriff Chuck Jenkins said he has reduced crime to record lows and detained close to 650 illegal immigrants during the two-year program.

"The governor misrepresents the program," he said. "I don't know that he fully understands it. It's a political hot potato and lawmakers are afraid to slip into this arena because of political fallout."

Ehrlich says he thinks states should not face punitive action for picking up where the federal government has "failed" in immigration enforcement.