ONE of the most unjustly neglected films of the past few years is Mike Judge's “Idiocracy”. Mr Judge is the genius behind Beavis and Butt-Head, two of the most disgusting creatures on television, and Hank Hill, one of the wisest. In “Idiocracy” he turns his talents to futurology—and to the troubling question of the long-term impact of dysgenic breeding, junk food and grunge culture on America's collective IQ.

The premise is simple. Two typical citizens—the army's “most average” soldier and a street prostitute—find themselves transported 500 years into the future. They soon discover that they are towering geniuses compared with the knuckle-draggers who inhabit the America of 2505. The country's best university is run by Costco. People are named after brands such as Frito and Mountain Dew. Starbucks has become a chain of brothels. The president is a former porn star and wrestling champion.

One might imagine that America's politicians would do all that they could to prevent Mr Judge's dystopia from materialising. But when it comes to immigration they are doing exactly the opposite—trying their best to keep the world's best and brightest from darkening America's doors.

Consider the annual April Fool's joke played on applicants for H1B visas, which allow companies to sponsor highly-educated foreigners to work in America for three years or so. The powers-that-be have set the number of visas so low—at 85,000—that the annual allotment is taken up as soon as applications open on April 1st. America then deals with the mismatch between supply and demand in the worst possible way, allocating the visas by lottery. The result is that hundreds of thousands of highly qualified people—entrepreneurs who want to start companies, doctors who want to save lives, scientists who want to explore the frontiers of knowledge—are kept waiting on the spin of a roulette wheel and then, more often than not, denied the chance to work in the United States.

This is a policy of national self-sabotage. America has always thrived by attracting talent from the world. Some 70 or so of the 300 Americans who have won Nobel prizes since 1901 were immigrants. Great American companies such as Sun Microsystems, Intel and Google had immigrants among their founders. Immigrants continue to make an outsized contribution to the American economy. About a quarter of information technology (IT) firms in Silicon Valley were founded by Chinese and Indians. Some 40% of American PhDs in science and engineering go to immigrants. A similar proportion of all the patents filed in America are filed by foreigners.

These bright foreigners bring benefits to the whole of society. The foreigner-friendly IT sector has accounted for more than half of America's overall productivity growth since 1995. Foreigner-friendly universities and hospitals have been responsible for saving countless American cities from collapse. Bill Gates calculates, and respectable economists agree, that every foreigner who is given an H1B visa creates jobs for five regular Americans.

There was a time when ambitious foreigners had little choice but to put up with America's restrictive ways. Europe was sclerotic and India and China were poor and highly restrictive. But these days the rest of the world is opening up at precisely the time when America seems to be closing down. The booming economies of the developing world are sucking back talent that was once America's for the asking. About a third of immigrants who hold high-tech jobs in America are considering returning home. America's rivals are also rejigging their immigration systems to attract global talent.

Canada and Australia operate a widely emulated system that gives immigrants “points” for their educational qualifications. New Zealand allows some companies to hand out work visas along with job offers. Britain gives graduates of the world's top 50 business schools an automatic right to work in the country for a year. The European Union is contemplating introducing a system of “blue cards” that will give talented people a fast track to EU citizenship.

The United States is already paying a price for its failure to adjust to the new world. Talent-challenged technology companies are already being forced to export jobs abroad. Microsoft opened a software development centre in Canada in part because Canada's more liberal laws make it easier to recruit qualified people from around the world. This problem is only going to get worse if America's immigration restrictions are not lifted. The Labour Department projects that by 2014 there will be more than 2m job openings in science, technology and engineering, while the number of Americans graduating with degrees in those subjects is plummeting.

Let them come

The United States is fortunate that it can solve its talent problem with the wave of a magic wand, by simply expanding the supply of visas to meet the demand. Raise the cap on H1B visas—or better still abolish it—and increase the supply of green cards, and the world's brightest will come flooding in. A country that is blessed with a dynamic economy and a world-beating higher-education system does not even have to go around wooing people, as other countries do.

Yet America suffers from one big problem: its political system is especially dysfunctional when it comes to immigration. A few brave souls are trying to lift the H1B visa cap. But most politicians are more interested in bellowing about building walls to keep illegal immigrants out than thinking seriously about the problem. And a few are even actively campaigning to reduce the number of H1B visas in order to keep American jobs for Americans. As Mr Judge might well wonder: how do you win the global talent wars when Congress is already in the hands of the idiocracy?