CASINO GAMBLING was the cart driving the horse in Annapolis in recent weeks. In the closing hours of the Maryland legislature’s session, the cart went on a joy ride and overturned, leaving the capital torn by recriminations and the state in disarray. Such is the outsize influence that gambling has come to exert in Maryland politics, particularly in the state Senate under President Thomas V. Mike Miller Jr.’s leadership.

Early in the session Mr. Miller (D-Calvert), the legislature’s puppet master extraordinaire, had ordered up what was known as a “doomsday budget.” The idea was to draft a blueprint whose supposedly draconian cuts — really just 2 percent of the state’s general fund spending — would be so distasteful that lawmakers would embrace ­income tax increases rather than allow cuts to programs large (law enforcement and public and higher education) and small (scholarship grants meted out at the sole discretion of state senators and delegates).

All was proceeding more or less according to plan until Mr. Miller’s pet project — expanding the state’s gambling program to authorize a sixth casino, in Prince George’s County, plus table games at existing ones — ran into opposition in the House of Delegates. Rather than let the gambling bill go down in flames, Mr. Miller let the clock run out. The legislature adjourned with no gambling bill, no income tax increases — and with a “doomsday” budget no one wanted.

In a sense, it was a fittingly failed ending to what was a deeply unimpressive legislative session. With the notable exception of a bill to legalize gay marriage — a historic achievement if it’s upheld by voters at referendum in November — lawmakers mostly flailed this year. They approved a shamelessly gerrymandered election map, ignored Maryland’s severe shortfall in transportation funding, caved to pressure from the teachers unions on school funding rules and then crashed and burned in the closing hours.

Gov. Martin O’Malley (D) decried what he called the egos at work in holding state spending hostage to the gaming industry’s interests. Unfortunately, that has been a theme in Annapolis for years now, and it will continue to be until Mr. Miller leaves the stage.

Lawmakers have gone home, but the jockeying is likely to continue over gambling, spending and taxes until a deal looks doable, at which point Mr. O’Malley will probably call the legislature back for a special session.

It’s tempting to say he shouldn’t bother; just let the “doomsday budget” prevail for a year. In truth, many Marylanders would scarcely notice the difference, although there would be an impact on schools and other programs, particularly in Baltimore City and Prince George’s County. And no one besides gaming companies will mind that the state hasn’t added table games or a sixth casino, given the sluggish performance of the existing venues.

Mr. O’Malley said it was a “damn shame” that lawmakers hadn’t been able to strike a deal on taxes and the budget. But the governor did nothing to interfere with the unholy interplay of gambling and politics that sabotaged the budget process. He simply said that expanding gambling was a distraction. Had he taken a more resolute stand, the state might not be in its current muddle.