An Uzbek immigrant has been charged by US prosecutors with causing the deaths of at least eight people in New York by mowing them down in a truck.
Sayfullo Saipov, 29, is also accused of providing material support and resources to Islamic State (IS) group.
He was shot and injured by police at the scene of the attack, and received treatment in hospital.
Prosecutors say he spoke freely to them, waiving his right to avoid self-incrimination while in custody.
Tuesday afternoon's attack saw a truck driven down a cycle lane in Lower Manhattan, hitting cyclists and pedestrians.
Six people died at the scene and two more in hospital. Twelve people were injured, nine of whom remain in hospital.
Federal court papers allege:
- Mr Saipov said the attack was planned two months ago
- He said he had intentionally chosen Halloween so that the streets would be crowded
- He wanted to display IS flags on the truck, but decided not to draw attention to himself
- Authorities recovered 90 graphic and violent IS propaganda videos from his phones
- He said he was inspired by them - in particular, one in which IS leader Abu Bakr al-Baghdadi asks what Muslims are doing to avenge deaths in Iraq
Earlier, New York Police's Deputy Commissioner John Miller told reporters: "He appears to have followed almost exactly to a 'T' the instructions that Isis has put out in its social media channels before, with instructions to their followers on how to carry out such an attack."
A second Uzbek man wanted for questioning in connection with the attacks has been found, investigators say.
"We are no longer looking for the person the information went out about," William Sweeney, assistant director of the FBI's New York field office, told reporters.
"We have found him and I'll leave it at that."
Who is the suspect?
Sayfullo Saipov had reportedly lived in Tampa, Florida, before moving to Paterson, New Jersey.
He arrived in America from Uzbekistan in 2010 and is a legal resident of the country. Uber confirmed he had been working as a driver for them.
CBS News quotes an intelligence source as saying he was known to US authorities after his name was associated with the subjects of FBI counter-terrorism investigations in 2015.
The source says he had some contact with individuals who were considered radicalised extremists, at least one of whom was Uzbek. It is unclear whether those being investigated were in the US or overseas.
It is unclear if Mr Saipov, who was not the main focus of the investigation, was interviewed at that time by the FBI.
Uzbekistan's President Shavkat Mirziyoyev told President Trump his country was ready to "use all forces and resources" to help investigate the attack. Uzbek officials have not yet confirmed the identity or nationality of the attacker.
What has been the reaction?
New York has increased the police presence at key transport hubs, and there will be additional uniformed and plain-clothes police on duty at Sunday's New York Marathon.
President Donald Trump said he was taking steps to end the diversity lottery programme - the immigration system under which the suspect entered the country.
He also attacked the US justice system, and said he would consider sending the suspect to the US military prison at Guantanamo Bay, Cuba.
- Trump backs Guantanamo for NY suspect
- What is the diversity green card lottery?
- How did Trump do in his terror response?
"We also have to come up with punishment that's far quicker and far greater than the punishment these animals are getting right now," he said.
The administration says it has not ruled out adding Uzbekistan to a list of countries in the president's proposed travel ban.
The mayor of New York City and the governor of New York state have both praised the resilience of New Yorkers - and urged people not to "politicise" a tragedy that took eight lives.
Governor Andrew Cuomo said: "He is a depraved coward, is what he is, and he was associated with Isis, and he was radicalised domestically."
Mr Cuomo and Mayor Bill de Blasio also suggested New York's strict gun control laws had ensured that high-powered weapons could not get into the hands of terrorists.
How did the attack unfold?
The attacker rented the truck from a New Jersey branch of retailer Home Depot on Tuesday afternoon before driving to New York City and entering the bike lane, police said.
Video cameras show the van driving at very high speed, appearing to target bike riders and pedestrians.
After the van collided with a school bus, its driver emerged and brandished what appeared to be two weapons.
Mr Saipov was shot and wounded at the scene by police officer Ryan Nash, 28, one of three NYPD officers who were nearby and attended the scene after being alerted by witnesses.
Knives, a paint gun and a pellet gun were recovered from the scene.
It was the deadliest terror attack in the city since 11 September, 2001, when nearly 3,000 people died at the hands of al-Qaeda attackers who flew hijacked aircraft into the twin towers of the World Trade Center.
Who were the victims?
The deaths of five Argentines were confirmed by the country's foreign ministry. They were part of a group of nine friends in New York to celebrate the 30th anniversary of their graduation from a polytechnic college in the central city of Rosario, Argentine media said.
One of the men who died, steel firm owner Ariel Erlij, helped pay for the friends' trip, La Nación newspaper reported (in Spanish).
The men - all aged 48 or 49 - were named as Hernán Diego Mendoza, Diego Enrique Angelini, Alejandro Damián Pagnucco, Ariel Erlij and Hernán Ferrucci.
Belgian officials said Anne-Laure Decadt, a 31-year-old from Staden in Flanders, was also killed. Three Belgians were wounded.
Two other victims, both Americans, have not yet been named.