Defending one’s political and religious beliefs to government officials is an obligation we associate with life in authoritarian regimes, not open societies. It’s becoming common, though, for foreign citizens who visit the United States — and even for Americans returning home after travel abroad—to be interrogated about their beliefs by customs and border personnel. These days, those seeking admission to the United States may also be required to surrender their cellphones and laptops, which can supply border agents with a wealth of information about travelers’ associations, communications, and activities online. Border agents use that information to draw conclusions, sound or not, about travelers’ ideological commitments.

Now the Trump administration, under the rubric of “extreme vetting,” is considering taking a further step by mandating that non-citizens disclose their social media handles and passwords and answer questions about ideology as a condition of admission to the country. The aim is to empower consular and border officials to ensure that would-be visitors to the United States embrace American values, a concept that the Trump administration has not defined. Secretary of Homeland Security John Kelly defended the idea in congressional testimony last week. “If they don’t cooperate,” he said of aspiring visitors, “they can go back.”

These new forms of vetting take advantage of travelers’ reliance on laptops, cellphones, and social media accounts, and in this sense they are products of the digital age. But this is not the first time that the U.S. government has experimented with ideological screening at the border. This practice has an ignominious history, and we can be confident that this new experiment with it will end badly. 

The McCarran-Walter Act, which Congress enacted in 1952, barred from the United States foreign citizens who had advocated anarchism or communism. President Harry Truman vetoed the law—“seldom has a bill exhibited the distrust evidenced here for citizens and aliens alike,” he observed when he returned the bill to the House of Representatives unsigned—but Congress passed the legislation over his veto.  Opponents of the law feared it would be used to exclude and stigmatize critics of U.S. foreign policy and to manipulate debate inside the United States, and these fears were justified. Successive administrations used the law as a tool of censorship, refusing visas to, among many others, Chilean poet Pablo Neruda, Colombian novelist Gabriel Garcia Marquez, South African novelist Doris Lessing, and British novelist Graham Greene.

The McCarran-Walter Act, and other so-called ideological exclusion laws, became an embarrassment to the United States—a testament to official paranoia and closed-mindedness. Pierre Trudeau, who later became Prime Minister of Canada, was barred from the United States after he attended a conference in the Soviet Union. Nino Pasti, a former four-star general in the Italian Air Force and Vice-Supreme Allied Commander of NATO for Nuclear Affairs, was barred from visiting the United States to speak about nuclear disarmament.  Typical of the rationale supplied for the exclusions was the one furnished by the State Department for its refusal to grant a visa to Italian playwright Dario Fo. “Dario Fo’s record of performance with regard to the United States is not good. Dario Fo has never had a good word to say about the United States.”

Congress repealed the McCarran-Walter Act’s oft-abused provisions after the fall of the Berlin Wall, but in the weeks after the September 2001 attacks the Bush administration revived the practice of ideological exclusion, denying visas to Swiss scholar Tariq Ramadan, South African human rights advocate Adam Habib, and Tamil rapper M.I.A., among many others whose criticism of U.S. foreign policy officials found to be disagreeable or inconvenient. (With colleagues at the ACLU, I litigated First Amendment challenges to the exclusions of Ramadan and Habib, and the Obama administration eventually reversed those exclusions.) In its Foreign Affairs Manual, the State Department instructed consular officers that the Patriot Act authorized them to exclude foreign nationals who had voiced “irresponsible expressions of opinion.”

The 21st century incarnation of this practice is likely to be especially insidious.  When the McCarran-Walter Act became law, few of the people seeking admission to the United States had published writing that consular officers could review.  Today, most of the people who present themselves at the border are writers and publishers, because the universe of expression that officials can inspect extends to text messages, tweets, blog posts, and Facebook “likes.” In addition, under the McCarran-Walter Act the censorial power ultimately resided in a relatively small number of officials in the State Department, but now this power is decentralized. Every border official will weigh the meaning and significance of travelers’ tweets and retweets. “The censor’s business is to censor,” the Supreme Court warned half a century ago—and now far more officials will be in the business.

There’s also an important difference in the nature of the writing that government officials are reviewing. Doris Lessing’s published writings about apartheid (she opposed it) and nuclear disarmament (she favored it) reflected her political views. A person’s retweets and “likes” and web-browsing history are unlikely to reflect her political views in the same straightforward way. What border agents are reviewing today may be better characterized as inquiry than speech. They are weighing what travelers thought, as well as what they said. Neither task is an appropriate one for American government officials.

Investing consular and border officials with the authority to vet visitors for disfavored political and religious beliefs is ill-advised. The exclusions will be capricious and discriminatory. They will have a chilling effect on speech and inquiry, both outside and within the United States. Foreign nationals who are contemplating visiting the United States will hesitate to write things that border agents might misinterpret, or to explore ideas online that border agents might view with suspicion. Americans can’t ultimately be excluded for declining to answer border agents’ questions about their beliefs, but Americans considering overseas travel may nonetheless self-censor for similar reasons.

The practice that the Trump administration is proposing to entrench and expand offends the First Amendment and the very idea of an open society, and it is a practice that history has already discredited. The digital-age version of it will be more pernicious than the Cold War one. It seems doubtful that the Trump administration will reverse course, but it should.