A massive security effort is in place to protect 51,000 runners and soft targets spanning five boroughs Sunday for the New York City Marathon, less than a week after the city suffered its deadliest terrorist attack since 9/11.

New York City Mayor Bill de Blasio said the "extraordinary event" spanning 26.2 miles will "be well protected" only days after a truck attack killed eight people in lower Manhattan.

The security detail will include hundreds of extra uniformed patrol and plainclothes officers, roving teams of counterterrorism commandos armed with heavy weapons, bomb-sniffing dogs and rooftop snipers poised to shoot if a threat emerges.

The Police Department is also turning to a tactic it has used to protect Trump Tower and the Macy's Thanksgiving Day Parade, using 16-ton sanitation trucks filled with sand. The trucks, along with "blocker cars," will be positioned at key intersections to try and prevent anyone from driving onto the course.

Marathoners from around the world who have been streaming into the city in anticipation of the race expressed mixed feelings about running so soon after the carnage.

"I can be really scared of it when I am at home and in front of the TV," Annemerel de Jongh, 28, of The Hague, Netherlands, told the Associated Press as she picked up her race number at a Manhattan convention center. "But when I am running I feel maybe a little bit invincible, like nothing can happen to me. I can run away from it."

The New York Police Department said it has no information pointing to any credible threat against the race, and that they'll use more of the blocker vehicles for the marathon than they've ever used for any other event.

WHY I AM RUNNING THE NEW YORK CITY MARATHON AS A GUIDE FOR A DISABLED RUNNER

Gov. Andrew Cuomo said the state police, the National Guard, the state Office of Emergency Management and other agencies will provide added security and double the number of troopers posted at high-profile locations, including Kennedy and LaGuardia airports.

The attack Tuesday, on a bicycle path miles from the marathon route, was a grim reminder of how the Islamic State terror group is using its propaganda to encourage radicalized "lone wolves" to cause harm with unsophisticated means in easily accessible settings.

The attack by an alleged ISIS supporter "appears to have followed, almost exactly to a T, the instructions ISIS has put out in its social media channels," said the NYPD's top counterterrorism official, John Miller.

An online Islamic State group magazine posted last year extolled using trucks to kill innocent victims, saying, "Vehicles are like knives, as they are extremely easy to acquire." It also advised "surveying the route for obstacles, such as posts, signs, barriers, humps, bus stops, dumpsters, etc. which is important for sidewalk-mounted attacks."

Investigators say there's evidence the suspect, 29-year-old Sayfullo Saipov, did reconnaissance before driving a Home Depot rental truck through an unobstructed entry to a bike path in lower Manhattan and mowing down cyclists and pedestrians. A police officer shot and wounded Saipov before he was arrested and charged with supporting terrorism and other federal counts.

The shift away from sophisticated large-scale attacks like the one on the World Trade Center's twin towers on Sept. 11, 2001, to smaller ones on soft targets has forced law enforcement to become more adept at how to prevent and respond to terrorism, said Karen Greenberg, director of Fordham Law School's Center on National Security.

"I don't think people should be worried," Greenberg said. "The police know what they are doing. Look at how few successful attacks there have been."

Safety adjustments made by organizers of the New York City Marathon following the bombing of the Boston Marathon in 2013 — like banning backpacks and costumes — remain in place, said Chris Weiller, spokesman for New York Road Runners. Despite widespread news reports and images of the trail of bodies left by the truck attack, the cancellation rate has remained about the same, he said.

Boston Marathon organizers, working with local, state and federal law enforcement, also significantly enhanced security along the course after the 2013 attack, including more officers deployed on race day, a no-fly zone over the course and drones to help with surveillance.

The Associated Press contributed to this report.