This week, the Senate is expected to take up immigration, almost 20 years after passage of the last major immigration bill. Immigration is in some ways an American success story -- half of all immigrants in the world head to the United States -- but also a story of failure -- we have an estimated 12 million illegal immigrants within our borders.

The House in December passed a border security bill. The Senate Judiciary Committee spent three weeks hashing over border security and illegal immigrant and guest workers' provisions.

Senate Majority Leader Bill Frist nudged it toward decision by announcing that he’d bring up a border security bill this Monday. Judiciary seems headed to a bipartisan majority on all three issues, which could go to the floor.

So the Senate may take action -- after which its bill would have to be reconciled with the House bill in conference, and then the result would have to be jammed through a House where a lot of Republicans hate anything that smacks of amnesty. George W. Bush has set out principles -- border security, a path to legalization, a guest-worker program -- and seems likely to sign anything Congress can pass.

The immigration issue shows us to be an attractive country with a vibrant economy -- and a government that seems on the verge of breakdown. Why can’t we protect our borders, many immigration critics, justifiably, ask. Increased enforcement in El Paso, Texas, and the fence built south of San Diego have reduced illegal crossings at those chokepoints.

But thousands of illegal immigrants walk across the border in the Arizona desert -- and some of them die of thirst in the sun. Some Republicans want to build a fence along the whole 2,000-plus mile border. But that would be very expensive, and it’s not clear that people wouldn’t be able to scale the fence in unpopulated areas -- and most of the border is unpopulated. The United States was able to control its borders when most immigrants arrived by ship and could be processed at places like Ellis Island. Now, it seems that immigrants can keep coming by land illegally, unless we can establish a way that they can come legally. Then at least we’d be able to keep tabs on them for homeland security purposes.

The 1986 immigration law included an amnesty on illegals and sanctions on employers of illegals. But the sanctions have proved toothless, since employers can escape liability by accepting pieces of paper that can easily be forged. The obvious solution is some kind of electronic verification. Visa and MasterCard transfer billions of dollars a day via plastic cards, with high reliability. But government has trouble with information technology: The FBI and the Federal Aviation Administration both had to abandon massive IT programs as unfeasible, despite years of effort and millions of dollars. The answer most likely is subcontracting the verification technology to the private sector.

Capitalism "laughs at frontiers,” wrote the French historian Fernand Braudel. The dynamic American economy has attracted illegal immigrants from Mexico and other Latin American countries to work in construction, hotels and restaurants, meatpacking, gardening and landscaping. We talk as if our immigration laws can structure our labor markets, but in practice, Congress’ task now is to get our immigration laws working in tandem with labor markets. We are not going to expel a population the size of the state of Ohio. But we shouldn’t simply acquiesce to violation of the law. We need to legalize and regularize the flow of immigrants the labor market demands.

And we need to encourage their assimilation into America. Opponents of immigration often express distaste with the growing Latino neighborhoods increasingly visible across the country. One hundred years ago, Henry James expressed similar distaste when he visited the Lower East Side of New York. But in time, those immigrants or their children were assimilated, and today their descendants seem as American as anyone else.

Assimilation then had the wholehearted support of leaders like Theodore Roosevelt; today, many of our elites have transnational (Samuel Huntington’s word) attitudes and regard assimilation as oppressive. The vast majority of ordinary Americans have better sense.

Congress, while rewriting the immigration law, ought to take care to encourage assimilation -- Americanization, as TR put it. For immigration is not just a challenge, it’s an opportunity.