An attack on Tuesday in Lower Manhattan that left eight people dead unfolded near one of New York City’s most storied schools, leaving two students injured and forcing hundreds of others to take shelter inside several local schools.

Around 3:05 p.m., a 29-year-old man plowed a rented Home Depot truck into multiple people on the bike lanes near the Hudson River before crashing into a school bus just steps from Stuyvesant High School, officials said. The unidentified man was shot by police in the abdomen after he stepped out of the truck holding what appeared to be two handguns, police said.

Two education department employees and two students on the bus were seriously injured, officials said. One student was in critical condition Tuesday evening, according to an education spokeswoman, who said she could not identify the school the victims attend due to privacy laws.

The attack, which the mayor labeled a “cowardly act of terror,” forced several local schools into lockdown.

“Today there was an act of terror in close proximity to several schools in Lower Manhattan,” schools Chancellor Carmen Fariña said in a statement. “We stand with the entire city as we mourn this senseless loss of life.”

“We are grateful to the first responders and school staff who work tirelessly to help keep our schools and communities safe,” she added, and said that trauma counselors will be dispatched to impacted schools on Wednesday.

Some students at Stuyvesant were still slowly being evacuated as of 6 p.m., almost three hours after normal dismissal time, according to Tahseen Chowdhury, a senior at Stuyvesant.

Chowdhury said he was in his AP Government class when students were asked over the loudspeaker to “shelter in place,” meaning they couldn’t leave the school building. When he stopped by the student government office after class, he and other students could see the wreckage along the West Side Highway outside the window.

“We saw the dead bodies — two in bags — and people who were hurt,” Chowdhury said. “There were mangled bikes all over the street.”

He added that some students were “rattled,” but the mood inside the school was otherwise relatively calm. Students are often outside the building during the time when the incident occurred, he said.

Two other schools also went into lockdown: P.S. 89 and I.S. 289, a middle school. The students were eventually allowed to leave, said the spokeswoman, Toya Holness.

“We know that this action was intended to break our spirit, but we also know New Yorkers are strong,” New York City Mayor Bill de Blasio said at a press conference Tuesday afternoon. “We will never be moved by an act of violence, an act meant to intimidate us.”

Stuyvesant, one of the city’s most exclusive public high schools, enrolls more than 3,000 students.

Its students were scattered across the school when they heard news of the attack. One ninth-grader was in the pool when his teacher told him to get out and ushered him and his classmates into a storage room. One of his classmates ducked into a random room. A 10th-grade student who had already left school for the day but had returned to pick up a coat she left behind, was locked out of the building.

Students who were huddled on the 10-story building’s upper floors took pictures of the street below, showing the bus crash and a swarm of police vehicles.

Benji Kaplan, a 10th-grader, was hanging out on a stair landing when a classmate who had been outside ran back into the building to say he had seen a man with a gun. At first, students thought it might be someone in a Halloween costume. Then they heard gunshots.

“That’s when it really sunk in,” Kaplan said. A teacher came to the landing and yelled for students to get down. Kaplan said they all dropped to the floor.

Kaplan said he ran to the auditorium, where students hushed each other as they hid behind stage curtains for what felt like half an hour. Every few minutes, someone from the school would get on the loudspeaker and tell students to sit tight, he said.

“It’s kind of surreal,” he said. “I’m still pretty shook.”

At 3:42 p.m. Tuesday, parents of Stuyvesant students received a message from the school on their phones, according to a parent who shared messages from the school with Chalkbeat.

“We are currently in a shelter in,” the message read. “Our students are safe in the building and will remain until further notice for their safety and so we do not interfere with police activity.”

At 5:23 p.m., the school’s parent coordinator, Dina Ingram, emailed families to inform them that students would soon be released from the building, though they were allowed to stay inside if they wanted. She added that school staffers would remain with the students, but parents would not be allowed to approach the building “for quite some time.”

“If your student stays in the building,” Ingram wrote, “they will be escorted out when you are close to the building to meet you.”

Sophie Oberfield, a Stuyvesant teacher, posted on Facebook Tuesday that the school was in “shelter…mode until further notice.”

“My students are being great,” she added. “Many in costume: a Christmas tree. A hot dog. Winnie the Pooh A minion. Stitch. A moose. Making tissue paper flowers, doing [homework], being calm.”