The attorney general was displeased in November when I criticized her decision to bring criminal charges against former state treasurer Tim Cahill for running ads promoting his leadership of the state lottery during his kamikaze bid for governor in 2010. I accused her of criminalizing the normal business of politics which — let’s face it — involves big doses of self-promotion, some at public expense. The jury in Cahill’s case deadlocked in December.

The attorney general’s irritation comes to mind because last week, Coakley and Cahill wisely reached an agreement to make the case go away, avoiding a second trial.

Cahill admitted to civil wrongdoing, and agreed to pay a $100,000 fine. He has five years to pay off the fine, and is on probation until he does so. Cahill also agreed not to run for office until he pays the fine; he wasn’t planning to run for office again anyway.

Coakley began talks with Cahill’s lawyer, Jeffrey Denner, right after the trial ended in a hung jury
. In an interview Sunday, she said her primary concern was that Cahill admit his wrongdoing. She suggested that his defenders had glossed over many of the salient details of the case.

“Facts do matter,” Coakley said. “This was money specifically intended for the lottery. These . . . ads usually run at Christmas and a few other times of year, but according to the campaign’s e-mails they ran them when they did because it would help his campaign. That is exactly the kind of conduct the statute is intended to deter.”

Cahill’s independent bid for governor was foundering in mid-summer 2010 when his handlers had the bright idea of capitalizing on the popularity of the state lottery, which Cahill oversaw as treasurer. The spot they decided to run is referred to as a “permission” ad, one that gives reluctant lottery players permission to gamble by reminding them that the money goes to fund wholesome activities like local aid and, indirectly, public schools.

The smart operatives who thought they could make a governor out of Cahill thought the permission ads could serve another purpose; giving voters permission to take another look at Cahill, whom many seemed to be dismissing. They ordered up a $1.5 million ad campaign, though the advertising was cut short after Coakley complained about it.

Cahill was tried under a new law that broadened the definition of unlawful campaign activities. The statute itself — meant to close loopholes that pols had marched through for years — has come under fire. As the outcome of the Cahill trial illustrates, juries may struggle with convicting lawmakers for activities that have traditionally been shady, but not illegal.

I asked Coakley how she views the future of the law.

“People have talked about whether the statute needs changing,” Coakley said, “It wasn’t that the jury struggled with what Tim Cahill had done. They struggled with the conspiracy law in Massachusetts. The law is a little vague and hard to follow. ”

The law Cahill was tried under was inspired in part by the case against Sal DiMasi, the disgraced former House speaker who claimed that some of his activities were legal under the existing state law. But as the Cahill case amply demonstrates, the new law isn’t perfect either. In fact, this case may well have a chilling effect on prosecutors who want to use it.

Predictably, debate has centered on who ultimately won the battle of Cahill v. Coakley.

As far as I’m concerned, common sense won. He deserved to be sanctioned, but probably not prosecuted. By the same token, Coakley successfully upheld the rule of law.

If prosecutors will think twice, so too will the next politician who might be tempted to prop up a struggling campaign with public money.

Adrian Walker is a Globe columnist. He can be reached at walker@globe.com. Follow him on Twitter:@Adrian_Walker.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.