Maryland Attorney General Douglas F. Gansler. (Cliff Owen/AP)

As Maryland gubernatorial hopeful Douglas F. Gansler presented it last week, his plan to “keep outside money out of Maryland” would require him and his Democratic rivals to sign a pledge discouraging third-party spending on the race.

If an organization other than a campaign spent money on radio or television ads, the candidate who benefited would have to pay a penalty by donating campaign money to charity.

A similar agreement was reached last year in the U.S. Senate race in Massachusetts between Scott Brown and Elizabeth Warren. Gansler, Maryland’s attorney general, said there was no reason it couldn’t work in Maryland.

This week, however, a state election official said there was a hitch: Maryland election law bans most charitable contributions by active campaigns.

“However noble it may be, it’s not allowed,” said Jared DeMarinis, director of the state election board’s candidacy and campaign finance division.

Gansler spokesman Bob Wheelock responded Wednesday by saying the pledge could still work because state law does allow campaign committees to donate to charities once they have shut down and have paid off all other debts.

So, Wheelock reasoned, the campaigns could agree to set aside funds when violations occur during the campaign and then make the donations to charity later.

All that is needed, he said, is for Gansler’s two declared rivals for the Democratic nomination — Lt. Gov. Anthony G. Brown and Del. Heather R. Mizeur (Montgomery) — to commit to making it happen.

“This can be worked out,” Wheelock said. “The first step is getting the other campaigns to agree to do it.”

Brown’s campaign manager, Justin Schall, wasn’t biting. He said Gansler’s proposed pledge was “well intentioned,” but he added, “We have been advised that it fails to comply with Maryland law.”

“We have been working on an alternative and will propose it in the coming days,” Schall said. “Our alternative will call for candidates to pledge to a positive campaign focused on real issues and will be in compliance with the law.”

Brown probably would have the most to lose if Gansler’s pledge was adopted. His campaign has been endorsed by several labor groups with a history of spending money to help preferred candidates.

Schall said he is not certain that it would make a difference when payments were made to charity because Maryland law makes clear that candidates are supposed to spend money donated to their campaigns on expenses related to their campaigns, as donors expect.

And doing so would require another departure from tradition: shutting down the campaign organization. Governors typically keep their political committees open after winning election so they can start raising money for reelection right away.

DeMarinis said that the idea of delayed donations to charity was not part of his discussion with the Gansler campaign this week and would require further study.

Wheelock later accused the Brown campaign of making a series of excuses to avoid signing the pledge. “Tomorrow, they’ll say their dog ate their homework,” Wheelock said. “Ultimately, voters want to know if they’re for limiting outside spending or against it.”