United States officials on Wednesday filed charges against an Uzbek immigrant who drove the truck that killed eight people and injured 12 in Manhattan on Tuesday. Twenty-nine-year-old Sayfullo Saipov was charged with providing material support to terrorists and violence and destruction of a motor vehicle causing death, The New York Times reported.

Investigators alleged the attack was planned two months ago. The Federal Bureau of Investigation found 3,800 images and 90 violent propaganda videos of the Islamic State group from Saipov’s phones.

Prosecutors said Saipov, who was earlier identified as an Uber driver, had planned his attack for Halloween because the streets would be crowded. He also wanted to display Islamic State group flags on his truck, but decided against it as it would draw attention, they said.

Saipov said he was inspired by the terror group’s propaganda videos, particularly one in which Islamic State group leader Abu Bakr al-Baghdadi asks “what Muslims in the United States and elsewhere were doing to respond to the killing of Muslims in Iraq”. Saipov came to the US in 2010, and has lived in Ohio, Florida and New Jersey.

It is not clear if the FBI is still investigating the Uzbek man whose wedding Saipov had attended.

The attack happened shortly after 3 pm local time on Tuesday (after 12.30 am Wednesday IST). Saipov drove a truck through a crowded path in Manhattan. After mowing down people, he smashed into a school bus, stopped and came out holding two handguns and shouted a statement “consistent with a terror attack”. The attack ended after he was shot at by a police officer and was later produced in a court in a wheelchair.

United States President Donald Trump ordered authorities to step up an “already extreme vetting” process for foreign travellers after the attack.