Joseph Steffen, 45, said he gave the governor his resignation after questions about his postings on www.FreeRepublic.com, a well-known conservative Web site. The postings discussed O'Malley's marriage.
The postings about O'Malley from a longtime Ehrlich aide carry particular significance because the mayor is expected to seek the Democratic nomination for governor next year and likely would challenge the incumbent.
The race is expected to be close, and the opposing camps are already jockeying for advantage.
Steffen is a longtime ally of the governor who had worked on several of Ehrlich's congressional campaigns. Democrats say he has earned a reputation in several state agencies as a sharply partisan appointee who was feared as he sought personal information about state workers and demanded that they be fired.
Ehrlich Communications Director Paul E. Schurick said the governor learned about Steffen's postings on the Web site late yesterday afternoon and was "extremely troubled by it."
"The governor made that clear publicly and privately. The governor never will support or condone such behavior and never has. It is unacceptable."
Steffen said he went to his boss, Insurance Commissioner Alfred W. Redmer Jr., and told him that he would have to resign.
"He winced," Steffen said of Redmer's reaction. Redmer is an Ehrlich appointee, former state delegate and House minority leader.
Next, Steffen said, he called Ehrlich administration officials to inform them of his pending resignation.
"They were basically like, 'If you think that's what you need to do,'" Steffen said.
He resigned shortly thereafter, Schurick said.
Schurick said he did not know whether Steffen had ever engaged in any other similar behavior.
"It doesn't matter," Schurick said. "It, in and of itself, is intolerable to the governor."
O'Malley could not be reached for comment last night.
"It is despicable and no family should ever have to endure these kinds of lies and this type of smear campaign just because their father holds a public office," said Rick Abbruzzese, a spokesman for O'Malley. "The mayor's marriage is strong."
O'Malley's father-in-law, Maryland Attorney General J. Joseph Curran Jr., decried the rumors and lamented their impact on his daughter's family. Curran's daughter, Catherine, a city District Court judge, is married to O'Malley.
"It is an outrage that people practice the politics of destruction rather than the politics of good government. I'm outraged that these things go on," Curran said.