President Donald Trump took aim at Senate Minority Leader Charles E. Schumer, D-N.Y., and the Diversity Visa Lottery Program in a series of tweets early on Wednesday morning, after a deadly terrorist attack in New York City the day before. The alleged attacker, Sayfullo Saipov, came to the United States from Uzbekistan under the program, which is more commonly known as the green card lottery.

So, for the record, here’s how the Diversity Visa Lottery Program came to be and how Schumer was involved. (Continued below).

The Facts

The story of the Diversity Visa Lottery program starts with the Immigration and Nationality Act of 1965. Signed into law by President Lyndon B. Johnson, it ended the Emergency Quota Act of 1921.

The law was aimed at reuniting families, so applicants who had immediate family living in the United States - children, spouses, siblings, parents - were given priority. This, however, had some unforeseen consequences. Immigrants from Latin American and Asian countries had come to the United States more recently, and they often had immediate family overseas who were prioritized under the new program. Many Europeans, by contrast, had been in the country for decades, so they had fewer close relatives remaining overseas.

According to data from the Census Bureau, after 1965 the number of white immigrants declined rapidly, while Hispanic, Asian and black immigration rose steadily.

The change in immigration policy hit the Irish particularly hard.

Unlike other European countries, Ireland faced political instability and an economic crisis in the second half of the 20th century. Before 1965, it had been relatively simple for Irish to immigrate. Anne Law, a political science professor at the City University of New York’s Brooklyn College, wrote in a 2002 paper: Ireland had been a “high quota country with a demand for immigration that was below the supply of visas.”

By the 1980s, the problem was clear - tens of thousands of Irish immigrants came to the United States as tourists or students and overstayed their visas. In 1988, the New York Times reported, “About 150,000 Irish immigrants came to New York as students or tourists over the last six years and stayed on as undocumented aliens.”

This was the problem that legislators were trying to fix in the mid- to late 1980s. In 1986, Rep. Brian J. Donnelly, D-Mass., proposed an amendment to the Immigration and Control Act that would provide a limited number of visas on a first-come, first-served basis to countries “adversely affected” by the 1965 legislation. The offer would be made only once.

After the one-off program concluded, Schumer, then a member of the House of Representatives, and others looked for a more permanent solution. In 1990, Schumer put forth a bill that proposed making a set number of visas available each year to “diversity immigrants” from “low-admission” countries. Despite being couched as a “diversity” action, it was openly pitched as a way to aid the Irish.

Schumer’s bill was absorbed into broader immigration legislation, which, when it passed the House, Schumer said he was “proud to put together a major portion of the bill that is going to say to Irish, to Poles, to Nigerians: You’re not going to be excluded anymore.”

The bill passed with bipartisan support in the House and Senate and was signed into law by then President George H.W. Bush on Nov. 29, 1990.

Fast-forward two decades. Schumer is now a member of the Senate. In 2013, he joined with the bipartisan Group of Eight senators who collaborated on what Schumer called “a common sense immigration reform proposal.”

The proposal was the most comprehensive overhaul of immigration reform that Congress had seen since 2007.

Among other things, as Sen. Jeff Flake, R-Ariz., pointed out on Twitter, the proposal eliminated the Diversity Visa Lottery Program. It would also have increased merit-based visas.

“In fact, had the Senate Gang of 8 bill passed the House, it would have ended the Visa Lottery Program AND increased merit based visas.

- Jeff Flake (@JeffFlake) November 1, 2017”

The bill passed the Senate. But never made it to the House floor. Then-Sen. Jeff Sessions, R-Ala., a longtime critic of immigration reform, played a key role in killing it. And his aide at the time, Stephen Miller, according to Politico, literally wrote the handbook that House members used to fight the deal. (Sessions is now attorney general and Miller is a senior adviser in the Trump White House.)

When then-House Majority Leader Eric Cantor, R, shockingly lost a primary in the summer of 2014, in which immigration pushed to the forefront of the debate - the reform effectively died.

When asked about Trump’s tweets, White House press secretary Sarah Huckabee Sanders defended the president’s recounting of history, telling reporters, “[Schumer] helped implement, on the front end, long before the Gang of Eight. And the Gang of Eight would have only addressed one part of that problem.”

The Pinocchio Test

Schumer did advocate for the diversity visa program in 1990, but Trump’s tweets entirely miss the context in which the program was created. Moreover, it’s not insignificant, as Sanders suggests, that he helped craft a bill that would eliminate it 23 years later. In addition to terminating the program, the immigration bill produced by the Gang of Eight would have increased a merit-based system, which is also included in legislation that the president has said he supports.

In attacking Schumer, the president is only telling a small part of the story. For this, he receives Three Pinocchios.