RALEIGH, N.C. (AP) — Legislation that would have authorized sports betting across all of North Carolina fell apart late Wednesday as the House narrowly rejected a key measure amid warnings about the dangers of gambling from an unusual coalition of social conservatives and liberal Democrats.

The House voted 51-50 not to approve one of two measures that, when combined, would have established the rules to authorize and regulate gambling on professional sporting events and out-of-state horse racing,

Prospects already looked shaky earlier Wednesday when the House voted by a similar 51-50 margin for a supplemental measure that would have mostly made changes to a separate, comprehensive bill unveiled last year that laid out the structure of how sports betting would be conducted. The supplemental measure focused on how gambling license operators would have been taxed and where the proceeds would have gone.

Several critics of the measures said state sanction of sports betting would create gambling addicts, leading to increases in theft, embezzlement and people deep in debt.

“If you vote for this you’re gambling that these two bills will control gambling, in North Carolina,” Rep. Jay Adams, a Catawba County Republican, told colleagues on the House floor. “This is just another opportunity to create unfortunate opportunities for people who can’t resist.”

The first measure had already taken a hit when the chamber voted by a comfortable margin an amendment to remove college sports from the list of games on which online or in-person customers could have wagered.

Rep. Jason Saine, a Lincoln County Republican shepherding the measures in the House this week, pointed out the supplemental measure survived a floor vote, so the gambling idea “is not totally dead.” But the General Assembly work session is likely to end late next week.

“It could resurface depending on what happens. If not, sports wagering is going to remain an issue for the state of North Carolina because ... states around us are doing it,” Saine said afterward.

Sports gambling took off in the states after a 2018 U.S. Supreme Court ruling. Twenty states and the District of Columbia now offer mobile sports betting, including the neighboring states of Virginia and Tennessee, according to the American Gaming Association, while 28 states and D.C. have some kind of in-person betting. The Eastern Band of Cherokee Indians opened on-site betting operations last year at its two far western North Carolina casinos thanks to earlier legislation.

Wednesday's defeat also means uncertainty about whether the state Senate and Democratic Gov. Roy Cooper, who had said he was ready to sign sports betting legislation, would be willing to accept less than the compromise that was unveiled this week. More than half of the Senate Republicans voted against the comprehensive measure that passed their chamber last August.

GOP Rep. Jeffrey Elmore of Wilkes County appears to have been the deciding vote on Wednesday. While Elmore voted for the supplemental measure, he voted no on the second, more comprehensive bill, House records showed. Elmore didn’t immediately respond to a phone message left at his legislative office.

Nearly one-fifth of the 120 House members didn’t vote, either with or without formal excuses for being absent — a sign of how tentative vote counting was.

Bill supporters said state residents already are participating in illegal sports betting through offshore online websites or local bookies, and it’s better for the state to control the activity and tax it.

North Carolina, the ninth-largest state by population, is currently an untapped market with several major-league sports franchises, college basketball, NASCAR and golf.

The measures would have authorized the issuance of between 10 and 12 interactive sports wagering operator licenses along with supplier and service provider licenses. People 21 and over within the state’s boundaries would have been able to play on their phones or computers starting in January. NASCAR tracks, golf courses, arenas and stadiums where professional sports are conducted could have betting sites in person or close by if the legislation had succeeded.

The legislation also contained $2 million for problem-gambling programs.

“I certainly understand the concerns of my colleagues on both sides of the aisle, but I also disagree with them,” said Rep. Wesley Harris, a Mecklenburg County Democrat who supported the measures. “The black market does exist and people are already gambling. But there is no regulation and there’s no help for those people.”

The supplemental bill also contained sweeteners on how the state’s share would have been distributed. Net proceeds would have benefited county youth sports programs, athletic departments for seven UNC system campuses and efforts to bring sporting events and attractions to the state.