In the several days after Tuesday’s terror attack in New York City, much political debate has centered on the Diversity Visa Lottery Program, which the terrorist used to enter the U.S. seven years ago.

The diversity visa doesn’t make much sense and should be done away with, but it is not by any means a gaping hole in our vetting system.

If we want to actually make the homeland safer after this attack, we should be talking about the real problem: how to do a better job detecting and stopping homegrown terrorists.

Let’s unpack this. The diversity visa is a lottery that gives out green cards, or legal permanent residence in the U.S., to 50,000 immigrants every year. The requirements for the program are twofold:

  1. Having a high school diploma or two years of work in an occupation that requires at least two years of training or experience to perform.
  2. Being from a country that has not sent more than 50,000 immigrants in the past five years, with more visas given to those countries and regions that send very few immigrants.

That’s it. Are you a Ph.D. from India that wants to move to the U.S.? You can wait in line for a different visa. Are you a young professional from Canada who loves the U.S.? Sorry, maybe you can come here on a temporary basis.

But if you have a basic education from Turkey, Uzbekistan, Kosovo, Namibia, or Benin—welcome to the lottery. Good luck with the spin of the roulette wheel.

The brain child of former Sen. Ted Kennedy, D-Mass., the diversity visa’s only purpose is diversity. It’s not about economics, it’s not about bringing the best and the brightest, it’s not about meeting employer needs, and it’s not even about family reunification.

It doesn’t take a genius to see that this program should be scrapped and replaced with a system that favors employment or skills—things that are actually in America’s national interests.

But while the diversity program is foolish from an immigration perspective, it is not inherently more of a security risk than any other visa program. Individuals using the diversity visa are subject to the same vetting standards as immigrants on any other visa.

According to my survey of terror attacks and plots in the U.S., this week’s is the only one committed by someone who entered through diversity visa. And contrary to popular belief, most terrorism in the U.S. has not been the result of terrorists sneaking through the vetting system.

The terror attack in New York brings the total number of Islamist terror attacks and plots against the U.S. homeland to 100 since 9/11. Of those 100, 87 were carried out entirely or substantially by homegrown terrorists—that is, terrorists who radicalized here in the U.S.

This is the case for the recent New York terrorist—he radicalized after he immigrated here.

No amount of vetting will tell us if an incoming immigrant will become a terrorist. And since we don’t live in the world of “Minority Report,” we also can’t predict when a fifth-generation American is going to radicalize and become a terrorist.

So yes, stop the diversity visa and replace it with something better. And yes, let’s improve our vetting. But in the case of the New York bike path terror attack, and the case of 86 other terror plots and attacks, the real area of action should be on tools and resources that will stop homegrown terrorists.

Let’s focus our security debate on something that will actually make a difference, like the importance of the 702 intelligence program, improving our homeland security enterprise (including state and local law enforcement), and the need to do a better job assimilating immigrants and refugees.

Doing so will make the U.S. more safe and prosperous.