The response of the president in the aftermath of Tuesday’s terror attack in lower Manhattan was both unfortunate and predictable: to lash out at immigrants and political adversaries.

“The terrorist came into our country through what is called the Diversity Visa Lottery Program, a Chuck Schumer beauty,” Donald Trump tweeted Wednesday morning, adding that the U.S. needs to get “MUCH tougher and smarter” on immigration and vowing an end to “Democrat Lottery Systems.” At a Cabinet meeting later on Wednesday, Trump announced his intention to "ask Congress to immediately initiate work to get rid of this program, diversity lottery,” he said.

The president is, perhaps obviously, mischaracterizing the program that allowed Sayfullo Saipov of Uzbekistan to enter the U.S in 2010 (and, notably, New York Governor Andrew Cuomo said on CNN that Saipov was “radicalized domestically” in the U.S., not prior to his arrival). The Diversity Visa Immigrant Program is a lottery in the sense that millions apply and there are relatively few winners; however, unlike a lottery, you can't simply put in for a ticket and hope your number gets called.

Get the think newsletter. This site is protected by recaptcha

People who enter the U.S. as part of the visa lottery must go through a process spelled out on the State Department website. To even be eligible for such a shot at a green card, a potential immigrant must first be from a qualifying country (one with low levels of immigration to the U.S., which rules out people from places like Mexico and China). Applicants must have a high school diploma or two years’ work experience. Then, they have to hope that theirs are among the names selected in a given year, or reapply the following year. The odds of selection are fairly slim; last year, about 11.4 million people applied for just 50,000 available slots.

The "winners" of the diversity lottery undergo the same vetting procedures as other legal immigrants: They must present valid documents, undergo background and medical checks, and submit to an in-person interview.

Senate Minority Leader Chuck Schumer speaks with reporters on Capitol Hill on Wednesday. Andrew Harnik / AP

In addition to distorting the nature of the diversity lottery, Trump is incorrect to blame Sen. Charles Schumer (D-NY) and Democrats for its existence. In 1990, then-Congressman Schumer was a sponsor of an immigration bill that provided for the diversity lottery, in an explicit effort to support more immigration access for Irish would-be immigrants. That proposal was folded into a broader immigration measure that passed Congress with bipartisan support: Republicans like then-Rep. Newt Gingrich (G-GA), now a frequent Trump defender), and senators like Mitch McConnell (R-KY), Orrin Hatch (R-UT), John McCain (R-AZ) and Chuck Grassley (R-IA) all supported it. It was signed into law by George H.W. Bush.

And, Congress already had a chance to get rid of the diversity lottery: The program was slated to end as part of an immigration overhaul proposed by the bipartisan ”Gang of Eight” in 2013. Their bill passed the Senate, only to die in the House of Representatives -- partly at the hands of now-Attorney General Jeff Sessions and his then-aide and now-senior White House adviser Stephen Miller.

The diversity lottery has come to represent the American ideal of equal opportunity: It signals that the U.S. is potentially open to all, not just those fortunate enough to have relatives here or in-demand skill sets. Its winners are a small percentage of the over one million people who receive a green card each year. And the program is not any sort of magnet for would-be terrorists: Though a 2007 Government Accountability Report on the program found some risks of fraud, it stated that “we found no documented evidence that (diversity visa) immigrants from these, or other, countries posed a terrorist or other threat.”

Sure, the diversity lottery may be imperfect. But, if the president is not happy with the existing program, why not instruct Congress to reform it, rather than ending it outright? Instead, with his tweets and comments, Trump is playing into people’s fears about immigrants and Muslims, and using a horrific event as an opportunity to advance his administration’s restrictionist agenda.

Then again, Trump may be cynically playing to his base at a time when his poll numbers are tanking, and hoping to distract people from his administration’s lack of an effective counter-terrorism strategy. Instead of responding in a thoughtful manner that would reassure the nation, Trump has politicized this tragedy. But this should not obscure the fact that the diversity lottery is a worthy program — and deserves to continue.