That provision received a boost last year when Baker threw his support behind a casino at National Harbor. Soon after, the developer of that site on the Potomac River enlisted Las Vegas giant MGM as casino operator.

Rawlings-Blake supported the expansion plan, largely because it would allow the Baltimore casino to add table games. Caesars Entertainment, the majority owner of the city casino license, said the benefits of table games would outweigh any disadvantages from increased competition and would allow it to build a larger, more luxurious casino.

The legislation that voters confronted Tuesday was put on the ballot during a special session called by O'Malley. The measure passed comfortably in the Senate but squeaked by with one vote to spare in the House.

The legislative action set off the largest flurry of political advertising in Maryland political history. Between them, Penn National, MGM and Caesars Entertainment shattered the old Maryland spending record for a single race — set in the 2006 gubernatorial election.

By Monday, MGM had spent more than $43.5 million and Penn National had spent $41.3 million on the ballot question. Total spending roughly equaled the amount spent on the past four Maryland gubernatorial races. Final campaign finance reports, due after the election, could drive the total close to $100 million.

Penn National's ads sought to raise doubts that Maryland leaders would devote new revenues from the gambling expansion to education. MGM and its allies countered by arguing that Penn National's true motivation was to protect its casino in Charles Town from competition.

In its campaign, MGM enlisted an array of political figures and celebrities, including O'Malley, Rawlings-Blake, and football stars such as ex-Raven Jonathan Ogden and former Washington Redskin LaVar Arrington. Also lining up behind the casino expansion were Baker, Howard County Executive Ken Ulman, Montgomery County Executive Isiah "Ike" Leggett and former Baltimore County Executive Jim Smith.

Penn National countered by enlisting Maryland Comptroller Peter Franchot to level the charge that the gambling expansion plan would not yield additional money for education.

The voters' decision affects only the most controversial parts of the new law: table games, a sixth casino and the tax reductions.

Left out of the referendum question were provisions transferring ownership of slot machines from the state to owners of the larger casinos, removing restrictions on hours of operation, setting up a state gaming commission to regulate casinos as well as the lottery, and expanding the ability of veterans groups to install slot machines in their halls.

That last provision was crucial to Speaker Michael E. Busch's efforts to secure the final votes needed for passage in the House of Delegates, including those of a handful of Republicans.

Through most of the debate over the legislation, there was no more forceful opponent than David Cordish, chief executive of the company that operates the Maryland Live Casino at Arundel Mills. But after behind-the-scenes talks with legislative leaders produced tax breaks to offset the prospect of added competition, Cordish withdrew his objections and moved to a position of neutrality.

True to his word, Cordish stayed out of the referendum fight as other casino companies battled it out.

If Question 7 is approved statewide and in Prince George's County, it would set in motion a process for determining which county location would get a casino license, and would allow existing casinos at Arundel Mills, Perryville and Ocean Downs to offer table games as soon as they complete the licensing process and install them. If the measure wins a statewide majority but loses in Prince George's, the sixth casino would not be built, but other provisions of the law — such as allowing table games at the five already approved casinos — would take effect.

Special correspondent Nahal Mottaghian contributed to this article.