Cast member Kevin Spacey poses at the premiere for the second season of the television series "House of Cards" at the Directors Guild of America in Los Angeles on Feb. 13. (Mario Anzuoni / Reuters)

It was 11:40 p.m. Monday. The end of the 2014 Maryland General Assembly session was 20 minutes away. Lawmakers had passed hundreds of consequential bills, including a minimum-wage increase and decriminalization of small amounts of marijuana.

Virtually all that remained was a standoff right out of “House of Cards” — literally.

The producers of the popular Netflix series, which is mostly filmed in and around Baltimore, had threatened to leave the state if lawmakers didn’t provide millions of dollars in additional tax credits. The House of Delegates balked at the Frank Underwood-style power play, thus prompting state senators, who wanted to keep the show in the Free State, to balk at the House members.

If the two sides could not agree, the incentive program would stand at $15 million, to be parceled out among “House of Cards” and other shows filming in Maryland, including HBO’s “Veep.” That might not be enough to keep Kevin Spacey’s Frank Underwood character from leaving. Senators figured they’d need $18.5 million.

What hung in the balance was $3.5 million more in tax credits — and whether state lawmakers could wield power over Hollywood.

View Graphic Can you guess where these “House of Cards” locations are in D.C.?

Money vs. power. The Senate vs. the House. The clock was running.

Three senators and three delegates huddled in a last-minute conference committee looking to see whether they could bridge the $3.5 million gap between what the House was willing to give and what the Senate thought was needed. The House would relent, but only if the Senate agreed to allow the state to go after the money when a TV show left the state anyway.

“Look, we’re talking about $15 million instead of $18.5 million,” said Del. Frank S. Turner (D-Howard), vice chairman of the House Ways and Means Committee and one of the conference committee members. The conversation went nowhere fast.

“I understand that,” said Sen. James E. DeGrange Sr. (D-Anne Arundel).

“So,” Turner said, “we’re talking about $3.5 million.”

“We understand,” DeGrange said.

Turner: “Right. So, is this language worth $3.5 million?”

DeGrange: “I think the $3.5 million makes a big difference.”

House Ways and Means Chairwoman Sheila E. Hixson (D-Montgomery) mostly listened. Sen. Verna L. Jones-Rodwell (D-Baltimore) compared the debate to a men’s anatomical measuring competition. House Majority Leader Kumar P. Barve (D-Montgomery) announced that he prefers the British version of “House of Cards.” And Sen. Roger Manno (D-Montgomery) lectured on the economic benefits of the film tax-credit program — largely a conversation with himself.

“We’re blowing the doors off every economic indicator,” Manno said at one point. A couple of minutes later, he tried again: “Why mess with a program that is blowing the doors off every economic indicator?”

Voices were raised. Body language was aggressive. Pulses were racing.

DeGrange zeroed in on Hixson, angering Turner. “I know you want to talk to Sheila — just Sheila — but this is a conference committee,” Turner said. “Three members of the House, three members of the Senate, okay?”

“I’m talking to the chairman,” DeGrange said.

He pressed Hixson to abolish the offending section. She held firm. Then came a 15-minute warning.

Maryland sets aside $7.5 million annually to reward film production companies that choose to film in the state. But that annual allocation has not always been enough to meet the needs of big-name productions, including “House of Cards,” which has received $26.6 million in tax credits so far. The show’s producers expected as much as $15 million for filming Season 3.

Media Rights Capital, the maker of “House of Cards,” told Gov. Martin O’Malley (D) and House Speaker Michael E. Busch (D-Anne Arundel) in January that if the money did not materialize, production crews would “break down our stage, sets and offices and set up in another state.”

The drama blew up from there, blurring the line between real politics and Hollywood politics. Lawmakers would quote the show’s central character — Underwood, an unscrupulous politician who threatens, charms and murders his way to greater power — while standing on the House floor, which had been used as a set in Season 2. Then Underwood, played by Spacey, came to an Annapolis wine bar in late March to snap selfies with lawmakers and whip votes for the tax credits.

The charge against the tax credits has been largely led by Del. C. William Frick (D-Montgomery), whose colleagues have dubbed him the Underwood of the House, though he is too mild-mannered to truly pull off the part. Frick has said he does not dislike the show; he just thinks this tax-credit program has gotten out of hand.

On Monday, a series of votes ended with the Senate refusing to agree to the House’s terms, which led to an hours-long game of chicken.

Delegates insisted that Maryland should have the power to reclaim its money if a production company skips town. The legislation was vague, saying the state officials would have the ability to revoke or reclaim tax credits “under certain circumstances.”

At 11:33 p.m., the negotiators gathered. Hixson and Barve, the House majority leader, told the senators that all of their concerns would be addressed by changing “shall” to “may.” Senators were not satisfied. They wanted the whole thing gone.

“I don’t think we have any time to get anything done at this point,” DeGrange said at about 10 minutes before midnight.

“Okay,” Hixson said.

A few seconds passed. “Did we just give up?” Jones-Rodwell said.

“We’re not giving up anything; we just can’t agree,” Turner said, hands up in despair.

DeGrange raised his arms, too. “You’ve done a good job running the clock out. That’s all I can say.”

Minutes later, confetti fell from the galleries. It was midnight. The session had ended. The legislation was dead.

The next move belongs to “House of Cards.” Its lobbyist, Gerard E. Evans, said he does not know what the show will do.

“I don’t think they realized what they did,” Evans said of the lawmakers, “the message that it sends to the film industry.”

Senate President Thomas V. Mike Miller Jr. (D-Calvert) said Tuesday that the state will find the money to keep “House of Cards” and “Veep” filming in the state.

The governor’s office is working with “House of Cards” to reach an agreement, a spokeswoman said.

“It’s not because we’re star-struck,” Miller said. “We want to keep these money-makers here.”