Stephanie Rawlings-Blake (D), the mayor of Baltimore, top, and Gov. Martin O'Malley (D), center, greet VIPs as they arrive for opening night at the Horseshoe Casino on Aug. 26 in Baltimore. (Bill O'Leary/The Washington Post)

Confetti was flying and fireworks were exploding, but Gov. Martin O’Malley looked decidedly unenthusiastic as he welcomed VIP guests at the launch of the Horseshoe casino in Baltimore last week.

O’Malley (D), who initially planned to skip the opening of Maryland’s fifth casino, offered the briefest remarks of all the speakers at a packed reception. He opted out of a ceremonial pull of a giant slots lever. And this energetic politician, who can play the showman when working a crowd, was long gone before the casino doors swung open to the public.

The episode reflected O’Malley’s ambivalence toward Maryland’s slow embrace of casino gambling.

The governor, who is traveling to Democratic functions across the country as he weighs a possible White House bid, once called slot machines “a pretty morally bankrupt way” to fund education. Research shows that gambling disproportionately preys on the poor, and the casino boom fits uncomfortably into O’Malley’s otherwise progressive legacy: a minimum-wage increase, repeal of the death penalty, expansion of immigrant rights and legalization of same-sex marriage.

Yet Maryland’s soon-to-be ­$1 billion-a-year casino industry would not have gotten off the ground without O’Malley’s active involvement, after years of bitter stalemate at the State House in Annapolis.

Maryland casinos

“It may not be something he wants to tout, but it’s absolutely part of his résumé,” said Thomas F. Schaller, a political science professor at the University of Maryland Baltimore County. “Maryland held out for a long time, and it’s now become a real player in the casino industry.”

Nearly $800 million in gambling proceeds has flowed into state coffers to help fund education, and the industry’s contribution is projected to grow much larger by the time the state’s sixth — and final — casino opens at National Harbor in 2016. The industry employs about 5,500 people, including those working at the Horseshoe, which is located along one of the main gateways into the city where O’Malley spent seven years as mayor.

Several current and former aides say O’Malley’s primary objection to state-sponsored gambling was the time the bitter legislative battle sapped from other priorities.

The governor said he regrets “the amount of energy it took to put this behind us” but believes that he and state lawmakers struck “a reasonable compromise on a really divisive issue.”

Casinos, O’Malley said, are not “a substitute for all of us doing our part to make the state better.”

In his remarks at Horseshoe, O’Malley praised the jobs that had been created, but the word “casino” did not pass his lips. His brief comments stood in stark contrast to those of Baltimore Mayor Stephanie Rawlings-Blake (D), who gushed about what she predicted would be “the most exciting casino in the mid-Atlantic region.”

O’Malley arrived in Annapolis in 2007, after four years of acrimonious State House debate over gambling. His predecessor, Robert L. Ehrlich Jr. (R), and Senate President Thomas V. Mike Miller Jr. (D-Calvert) had pushed relentlessly to legalize slot machines; House Speaker Michael E. Busch (D-Anne Arundel) and his chamber resisted.

Gov. Martin O'Malley addresses guests at the grand opening of Horseshoe Casino Baltimore on Aug. 26 in Baltimore. (Larry French/Getty Images For Caesars Enterta)

Proponents of slots argued that Marylanders were taking their money to play in the surrounding states of Delaware, West Virginia and Pennsylvania, where the machines were legal.

O’Malley offered a compromise that called for putting the issue to voters on the 2008 ballot. A ballot measure was approved, authorizing slots in five locations around the state, and O’Malley expressed hope that the legislature could move on to other priorities.

Before long, gambling advocates started pushing for a sixth location, in Prince George’s County, and for Las Vegas-style table games, such as blackjack and roulette, that had been approved in other states. O’Malley reluctantly agreed to call a special legislative session in 2012 to act on those proposals.

“This is not so much about what we want as what we need to get behind us,” he said at the time. “I don’t know a single member of the General Assembly who ran for office wanting to deal with the issue of gaming year in and year out. For crying out loud, aren’t we all tired of this by now?”

Miller, the Senate president, said O’Malley was “pushed along the way by his need for revenues to continue to fund education.”

“Anybody who’s a progressive, who considers themselves an intellectual, they don’t like the issue either,” Miller said. At the same time, he said, “if [O’Malley] hadn’t gotten involved, it absolutely, positively would not have happened.”

Busch credited the governor with putting together a gambling program that has been well run and fair to the companies that bid for casino licenses. Among Busch’s earlier objections to slots was that they would lead to “unjust enrichment” of pre-selected racetrack owners.

“In the final analysis, whether you like gaming or you don’t like gaming, it’s been put in place in an appropriate manner,” Busch said.

Still, some observers say, O’Malley’s record on gambling is at odds with the political persona he has presented during visits to states such as Iowa and New Hampshire and in speeches on behalf of Democratic candidates across the country.

“It’s hard to project an image as a progressive when you know that this will bankrupt some people and put a dent into some working-class families,” said Schaller, the political scientist. “It’s nice to have the tax revenue, but you wonder who’s picking up the tab.”

Gerard E. Evans, an Annapolis lobbyist whose clients have included several gambling interests, said, “Gambling is not a first choice for any politician, because it does involve addictive behavior.”

But, Evans said, Maryland is capturing gambling revenue that had been flowing to surrounding states. “When you’re governor, sometimes you have to swallow hard and do the responsible thing,” he said.

Gambling interests also have played a role in O’Malley’s political activities. Caesars Entertainment, the lead company behind the Horseshoe, gave $100,000 to the Democratic Governors Association in 2012, during O’Malley’s tenure as chairman of the group, which seeks to elect party members nationwide. Aides have said such contributions have no influence on O’Malley’s policy views.

Commercial casinos now operate in 23 states. Plenty of other governors also have chosen to bolster their state budgets with gambling proceeds. Still, in his frequent political travels, O’Malley rarely talks about Maryland’s burgeoning casino industry.

Kathy Sullivan, a former chairwoman of the New Hampshire Democratic Party, said voters will give much more weight to other issues when deciding on a presidential candidate.

“It’s not like you can go around saying, ‘Nominate me for president because I put up a bunch of casinos in Maryland,’” Sullivan said. “That’s not going to work.”