THE UNITED STATES has invested tens of billions of dollars in the past decade alone to foil illegal immigration — tightening the border, accelerating deportations, deputizing local police — while doing precious little to stop employers from hiring undocumented immigrants.

That is fixable — by means of a universal national identity card — and must be fixed as part of any sensible overhaul of the nation’s immigration system.

Critics of immigration reform are right that the last big attempt to fix the system, in 1986, was no fix at all. Millions of undocumented immigrants were given amnesty but without any effective provision to stop future illegal migrants from entering the country or overstaying their visas.

If the current attempt to reform the system includes a provision to legalize some 11 million illegal immigrants — and we hope it does — it must not repeat the mistake of 1986. That means establishing mechanisms to ensure an adequate supply of legal immigrant labor, skilled and unskilled. And it means deterring unauthorized entry.

There are two ways to achieve that goal. One is to deploy sensors, drones and thousands more agents along the border, as both the George W. Bush and Obama administrations have done, to significant effect. The other is to make it easy for companies to detect and reject undocumented job applicants and for the government to prosecute employers who flout the law. If illegal immigrants can’t get jobs, they won’t come to this country.

An effective solution would be to issue tamper-proof, biometric ID cards — using fingerprints or a comparably unique identifier — to all citizens and legal residents. Last week, both President Obama and a bipartisan group of eight senators seeking immigration reform urged something along those lines, without calling it a universal national identity card. That’s a major step forward.

The senators proposed requiring job applicants to demonstrate legal status and identity by “non-forgeable electronic means,” along with “safeguards to protect American workers, prevent identity theft, and provide due process protections.” The president proposed a “fraud-resistant, tamper-resistant Social Security card,” among other secure documents, to prove work eligibility.

Critics on both the civil-liberties left and the libertarian right have long resisted such cards as the embodiment of a Big Brother brand of government, omniscient, invasive and tentacular. Their criticisms ring hollow.

More than a third of Americans (35 percent) possess passports, up from just 6 percent 20 years ago — and all passports issued since 2007 contain chips that enable biometric use of facial recognition technology. The proliferation of passports for foreign travel has not encroached on Americans’ civil liberties. Why would another form of ID, used for employment verification, pose such a threat?

Yes, unscrupulous employers could still ignore the law, but doing so would become riskier and more prone to enforcement. Critics contend that a national ID would only drive up the cost of counterfeit documents. Would they prefer that falsified documents are cheap?

A phased-in, reliable ID might have other benefits — for instance, to safeguard voting. That should satisfy Republicans who insist that IDs prevent fraud at the ballot, as well as Democrats who believe Republicans want to suppress voting.

Inevitably, there would be glitches and errors. But with effective safeguards for privacy and against government prying, the benefits would easily outweigh the costs.