A young NYPD officer successfully shot and detained terror suspect Sayfullo Saipov before more people were killed in Tuesday’s attack, the New York Daily News reported.

Officer Ryan Nash, 28, who joined the force in 2012, was called to the scene while attending an incident at the nearby Stuyvesant High School involving an emotionally disturbed 17-year-old girl threatening to take her own life.

Police have identified 29-year-old Uzbek citizen Sayfullo Saipov and state that he is the jihadist terrorist guilty of rampaging through a bicycle lane in downtown Manhattan and mowing people down with a Home Depot rental truck on Tuesday afternoon, just as school classes ended.

According to witnesses, Saipov shouted, “Allahu Akbar” upon exiting the truck, which ended its attack near the World Trade Center — the site of the September 11 terrorist attacks.

After demanding that Saipov surrender, Nash opened fire, hitting him in the abdomen, and consequently, detained the suspect. Saipov was then taken to Bellevue Hospital and remains in police custody. A paintball gun and pellet gun were recovered at the scene, law enforcement officials confirmed:

NYPD officer Ryan Nash's quick actions stopped a terrorist from taking even more lives in Lower Manhattan https://t.co/W6rl5Z9oKC pic.twitter.com/hp3WgUahOR — New York Daily News (@NYDailyNews) November 1, 2017

Saipov allegedly killed eight people and injured dozens more. Wednesday morning, police found a note in the truck in which Saipov pledged allegiance to the Islamic State, which authorities stated was written in Arabic and proclaimed the immortality of the terrorist group. The Islamic State has previously urged “lone wolf” attackers to target tourist hot spots such as New York through the use of vehicles or other dangerous weapons:

JUST IN: Photo of Sayfullo Habibullaevic Saipov, 29, of Tampa, Florida, suspect in deadly NYC terror attack https://t.co/zof4fpEths pic.twitter.com/Oq0Trli4UG — CBS News (@CBSNews) October 31, 2017

“A uniformed police officer confronted the subject and shot him in the abdomen,” NYPD Commissioner James O’Neill said. “I want to commend the response of our NYPD officer that was on post near the location, who stopped the carnage moments after it began.”

According to reports, Saipov entered the United States eight years ago through the Diversity Visa Lottery program, which secures 50,000 visas every year for foreign nationals. Those rewarded through the program include many from terror-prone nations such as Afghanistan, Algeria, Egypt, Iraq, Lebanon, Libya, Nigeria, Saudi Arabia, Somalia, Syria, Trinidad and Tobago, Venezuela, Yemen, and Uzbekistan.

President Donald Trump has heavily criticized the program, describing it as a “Chuck Schumer beauty” and confirmed he had ordered Homeland Security to “step up [the] already extreme vetting program”:

The terrorist came into our country through what is called the "Diversity Visa Lottery Program," a Chuck Schumer beauty. I want merit based. — Donald J. Trump (@realDonaldTrump) November 1, 2017

“We are fighting hard for Merit-Based immigration, no more Democrat Lottery Systems,” Trump added. “We must get MUCH tougher (and smarter).”

Follow Ben Kew on Facebook, Twitter at @ben_kew, or email him at bkew@breitbart.com.