Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A quick-thinking police officer with five years on the job stopped the deadliest terrorist attack in New York City since Sept. 11, 2001.

City officials hailed Officer Ryan Nash, 28, for shooting and apprehending Sayfullo Habibullaevic Saipov, the suspect accused of mowing down at least eight people with a rented truck in lower Manhattan on Tuesday.

"He was a hero," Gov. Andrew Cuomo said at a news conference Wednesday.

Ryan Nash, the police officer credited with stopping the New York City terrorist attack. @JoeBorelliNYC / via Twitter

Saipov, 29, a native of Uzbekistan who entered the United States in 2010, was charged with two federal counts Wednesday.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Mayor Bill de Blasio, who said he had spoken to Nash since the attack, praised the officer for his bravery and humility.

"He is a good young man. He was very humble about what he did, but what he did was extraordinary," the mayor said Wednesday. "And it gave people such faith and such appreciation in our police force."

In a brief on-camera statement Wednesday afternoon, Nash thanked his family and friends for their support.

"I understand the importance of yesterday's events and the role we played," he said, referring to his fellow officers. "I'm grateful for the recognition we received."

He added: "However, due to the nature of the pending criminal case, I cannot make any further public statements about the incident at this time. Thank you."

Nash was reportedly out on a routine call on Tuesday afternoon when he and his partner were summoned to help with a student at nearby Stuyvesant High School who had indicated that he wanted to kill himself, a person familiar with the details of the incident told The New York Times. NBC News has not independently confirmed those details.

But after Saipov crashed his truck into a school bus and ran into the streets, the officers darted to the scene, coming face to face with Saipov, who appeared to be toting weapons. That's when Nash opened fire, shooting Saipov in the abdomen. Authorities later said Saipov was armed with a pellet gun and a paintball gun.

Related: Who Were the Victims of the New York City Attack?

City Council member Joe Borelli of Staten Island apparently was the first public figure to identify Nash as the heroic officer.

"Here's the hero cop the world should be talking about," Borelli tweeted just before 8:30 p.m. Tuesday. "Police Officer Ryan Nash risked his life to save others. Thank u Ryan, thank u."