WASHINGTON — Sen. Ted Cruz is in a pinch on gun control.

Cruz has been aligned throughout his career with the most ardently anti-regulation gun owners in the country, and they oppose a bill sponsored by Cruz's fellow Texas Republican, Sen. John Cornyn. Cornyn's legislation, co-sponsored by Sen. Chris Murphy, D-Conn., would force greater participation in the National Instant Criminal Background Checks System (NICS) to ensure that all information is up-to-date.

If Cruz, who is up for re-election this year, sides with the hard-liners this time, he'll be at odds with both his Democratic challenger, Rep. Beto O'Rourke, and the National Rifle Association, which has endorsed the Cornyn bill. O'Rourke has raised nearly $8.7 million for the race, giving some Democrats hope they can flip a state that hasn't elected one of them to the Senate since 1988.

So far, Cruz hasn't taken a position on the Cornyn-Murphy bill.

"Senator Cruz agrees that we need to find solutions to prevent further mass shootings and he believes it can be done without stripping law-abiding citizens of their constitutional liberties," Cruz spokeswoman Catherine Frazier told NBC News. "He is closely reviewing the various legislative proposals that are being debated."

Frazier added that Cruz is looking to find ways to prosecute those who buy guns illegally, address mental health issues and make sure crimes are reported to the NICS database without abridging the Second Amendment.

Cruz is expected to cruise through the GOP primary on Tuesday, which could give him more flexibility once the votes are counted.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

At that point, said Cal Jillson, a political science professor at Southern Methodist University in Dallas, Cruz could sign on to the Cornyn bill or other legislation that firms up the national background-check system "to blunt any advantage that O'Rourke might have."

In 2013, Cruz, along with Sen. Chuck Grassley, R-Iowa, introduced an amendment during a debate over gun-control measures that addressed requirements for states to report information to the federal background-check system. It also would have loosened restrictions on the interstate transportation and sale of firearms, and it included a series of school-safety measures.

The NRA supported the Cruz-Grassley amendment.

At the time, Mayors Against Illegal Guns criticized the amendment because it would have cut the maximum amount authorized for financial incentives to states to report information to the background-check system, and the group ran ads against Republicans who voted for it.

Neither the Cornyn-Murphy bill nor the Cruz-Grassley measure would require universal background checks — including at gun shows and private sales — which many Democrats and some Republicans want. But the Cornyn plan has 50 senators signed up, evenly divided between Republicans and Democrats.

For now, Cruz has been given a reprieve by fellow libertarian-minded conservative Sen. Mike Lee, R-Utah, who objected to an effort by Senate leaders to bring up the Cornyn measure for a vote. Senate Majority Leader Mitch McConnell, R-Ky., has said that he wants to bring it to the floor "at some point" if "there's a way forward" — a big if.

And President Donald Trump scrambled the political debate over guns last week when he met with a bipartisan group of lawmakers and embraced a series of gun-control proposals that do not have the support of gun-rights groups and activists.

If the Cornyn bill does come up for a vote, Cruz will have to choose whether to stick with his base or move closer to the middle at a time when O'Rourke is heavily courting the suburban voters who helped Hillary Clinton win some Republican-held congressional districts in the Dallas and Houston areas during the 2016 election.

Jillson said there could be a political cost to Cruz.

"If Cruz were to stay as hard pro-gun as he could and Beto O’Rourke were to be in a more moderate position," he said, "then you could imagine some suburban women who are nervous about Trump and the Republican Party agenda more generally thinking harder than they normally would" about which candidate to support.

Not only does O'Rourke back the Cornyn bill, he also favors universal background checks for gun purchasers — a position that puts him on the same side as the vast majority of Texans.

In February 2016, the University of Texas' Texas Politics Project released a poll showing that 78 percent of state residents, including 70 percent of Republicans, favor universal background checks. Perhaps most important in the battle for the support of women in the suburbs of Dallas, Houston, San Antonio and other cities, 85 percent of women in Texas back universal background checks, the poll found.

And yet only 24 percent of Texans said in October that current gun laws are at fault for mass shootings, and only 4 percent of Republicans held that position. That is to say, gun control is not exactly a black-and-white, or red-and-blue, issue.

Victoria DeFrancesco Soto, a political science lecturer at the University of Texas in Austin, said Cruz has two basic brands: Very conservative and contrarian.

"Putting those two together, my money is on him not joining in with the Cornyn-Murphy bill," she said.