On Wednesday, President Trump attacked the diversity visa program, which offers 50,000 visas a year, alleging that it was how the suspect in the Manhattan attack came to the United States.

“The terrorist came into our country through what is called the ‘Diversity Visa Lottery Program,’ a Chuck Schumer beauty. I want merit based,” Trump said on Twitter, pushing instead for a system that would give preference to highly educated individuals who are considered more employable. “We are fighting hard for Merit Based immigration, no more Democrat Lottery Systems. We must get MUCH tougher (and smarter).”

Later, Trump told reporters he was “starting the process of terminating the diversity lottery program.” He added that “we have to get less politically correct,” and although the program “sounds nice,” he said, “I’m not nice.”

Despite its name, though, the diversity visa program was initially intended to make the flows of legal immigrants to the United States more closely resemble the demographic profile of existing American citizens—admitting more Europeans to the United States.

Schumer did play a key role in the creation of the program, which was partially rooted in a bill he drafted in 1990. But four years ago Schumer, along with a bipartisan group of senators, proposed repealing the program. In 2013, the Gang of Eight tried to overhaul the nation’s immigration system by, among other things, eliminating the diversity visa program. “I guess it’s not too soon to politicize a tragedy,” Schumer said on Twitter.

Senator Jeff Flake, a vocal critic of Trump and member of the Gang of Eight, came to Schumer’s defense:

The diversity visa program was established in 1990, in response to the unanticipated results of immigration reforms years earlier. In 1965, Congress scrapped the controversial quota system, which permitted entry based on individuals’ nations of origin, and opened the doors to immigrants of all nationalities. The legislation had sweeping results. As Tom Gjelten wrote in The Atlantic: “Seven out of every eight immigrants in 1960 were from Europe; by 2010, nine out of 10 were coming from other parts of the world.” The significant change in the country’s demographics elicited a response from some lawmakers.

“They were trying to help co-ethnics, who couldn’t tap into the immigration stream given the new categories,” said Anna Law, professor of constitutional studies at the City University of New York.

The population of unauthorized immigrants from Ireland was on the rise, as thousands fled Ireland’s economic troubles. Few were able to come to the United States under the 1965 Immigration and Nationality Act, which, among other things, prioritized close relatives of U.S. citizens and lawful permanent residents. Tens of thousands instead arrived on tourist visas, staying past their expiration.

They mounted an effective lobbying campaign, pushing for changes to immigration law. The Irish Immigration Reform Movement, a grassroots organization, lobbied Congress for the legalization of the Irish population.

In 1986, Congress created a one-time lottery that distributed 40,000 visas, on a first-come, first-served basis, to citizens of 36 countries deemed disadvantaged by then-current immigration law. Of the first 10,000 claimed, 40 percent went to Irish immigrants. A second lottery, approved in 1989, widened eligibility to citizens of all but the 12 countries with the largest flows of immigrants.

And in 1990, Congress made a version of the system permanent, with the diversity visa program. It would give preference to immigrants from countries who did not regularly migrate to the United States, distributing 20,000 visas each year. The bill also included a three-year transitional program, which legalized 48,000 Irish immigrants.

Today, the diversity visa program provides up to 50,000 visas each year. According to the Department of State, the visas “are distributed among six geographic regions and no single country may receive more than seven percent of the available DVs in any one year.” Over time, the percentage of these visas allocated to immigrants from Europe has declined, while the share coming from other regions—particularly Africa and Asia—has surged.

Vetting for the diversity visa program is no different than for other programs, Law said. It’s not clear therefore whether the merit immigration system would be any more effective at screening prospective terrorists, but at the very least, the president’s tweets on Wednesday seem sure to ignite another round of debates about the diversity visa program.