Mandatory background checks are a terrible idea. They burden law-abiding citizens and don't catch criminals. The databases they rely on are riddled with errors. We don't even prosecute people who flunk the checks. That's why Republicans are against imposing such checks on gun buyers.

On the other hand, if you want to catch illegal immigrants, forget everything I just said. Running everybody through a database is a terrific idea. Republicans are all for it.

How did the GOP end up in this position? The story begins a couple years ago, when Sen. Charles Grassley, R-Iowa, introduced the Accountability Through Electronic Verification Act. Grassley explained that it would "require that all employers use the E-Verify program," a "web-based tool that allows employers to verify the work eligibility of new employees," thereby "combating the hiring of illegal aliens." Companies would have to "check the status of existing employees within 3 years" and "terminate the employment of those found unauthorized to work."

Advocates of immigration control loved E-Verify. But libertarians hated it. They called it a "national identification and surveillance system" that would help the government "compile and monitor the personal information of every person seeking employment." They predicted that instead of flagging illegals — a task at which the system failed more than half the time, according to one analysis — mandatory checks would simply "increase the number of employers and workers who resort to the black market."

They also protested that the system generated too many "false positives" — "people wrongly labeled as undocumented by the system and then forced to undergo additional paperwork and fees to clear their names." Indeed, the E-Verify website has acknowledged that more than 98 percent of employees subjected to checks are perfectly legal. All in all, the opponents concluded, an E-Verify mandate would impose a "flawed, costly system on law-abiding citizens."

These objections failed to sway Sen. Marco Rubio, R-Fla. Rubio cosponsored Grassley's bill. "We can't be the only nation in the world that does not enforce its immigration laws," Rubio argued. Since then, Rubio has repeatedly reaffirmed his support for mandatory E-Verify.

While Rubio was busy making this case, a different law enforcement problem exploded. In Arizona, Colorado and Connecticut, three deranged gunmen murdered dozens of children and adults. The massacres provoked a national debate over how to prevent future killings. Some senators proposed legislation to require background checks for anyone buying a firearm. Buyers' names would be run through a database of people convicted of felonies or certified by a judge as dangerously mentally ill.

Did Rubio embrace this idea? Of course not. He signed a letter pledging to block the Senate from even voting on "any legislation that will serve as a vehicle for any additional gun restrictions." Two weeks ago, he promised to "filibuster any gun control proposals that seek to restrict the rights of Americans who have never violated the law."

"Efforts to legislate limitations on gun ownership will only work on those of us who are already predisposed to obey the law," said Rubio.

You don't need to be a native English speaker to recognize the hypocrisy. In the age-old dilemma between liberty and law enforcement, Rubio switches sides depending on the issue. He believes passionately that laws designed to catch lawbreakers don't work, that inconveniences to law-abiding citizens are intolerable, and that government databases are unacceptably dangerous — but only if you're buying a gun.

As long as guns and immigration were debated separately, Republicans were able to conceal this dance, borrowing libertarian arguments against gun control while ignoring them in the context of immigration. But now the two issues have converged on the Senate calendar.

Last weekend, when Rubio went on several Sunday shows to discuss immigration, he was forced to talk about guns as well. It wasn't pretty. On ABC's "This Week," he was asked why anyone buying a firearm online or at a gun show shouldn't have to go through a criminal-background check. He replied:

"Criminals don't care about the laws that we pass with regards to guns. They never follow the law. … these laws that people are discussing will not effectively deal with that problem but will infringe on the Second Amendment rights of law-abiding citizens."

You could say the same about E-Verify. It blocks the transaction in question — hiring — but isn't designed to launch prosecutions. It targets people who have broken the law and are accustomed to navigating black markets. It yields a high rate of false positives, burdening the law-abiding majority.

Yet when Rubio was asked in the same interview about immigration, he brushed aside such skepticism. "We are going to get the toughest enforcement measures in the history of this country," he assured viewers. "We are going to have E-Verify, universally, which means that you will not be able to find a job in the United States if you're not legally here."

I don't mean to pick on Rubio. His selective, alternating appeals to liberty, cynicism and public order hardly distinguish him. The current Senate bill to deploy E-Verify against illegal immigrants has 11 sponsors and cosponsors. All but two of these senators voted last week to block debate on background checks for gun purchases. And these nine are just the tip of the iceberg.

So let's drop the pretense. Most politicians standing in the way of background checks for firearms don't really believe in freedom or limited government. They simply care more about controlling immigration than they do about controlling guns.