– The Boston Marathon bombers were headed for New York’s Times Square to blow up the rest of their explosives, authorities said Thursday, in what they portrayed as a chilling, spur-of-the-moment scheme that fell apart when the brothers realized the car they had hijacked was low on gas.

“New York City was next on their list of targets,” Mayor Michael Bloomberg said.

New York Police Commissioner Raymond Kelly said Dzhokhar Tsarnaev told interrogators from his hospital bed that he and his older brother decided on the spot last Thursday night to drive to New York and launch an attack. In their stolen SUV they had five pipe bombs and a pressure-cooker explosive like the ones that blew up at the marathon, Kelly said.

But when the Tsarnaev brothers stopped at a gas station on the outskirts of Boston, the carjacking victim they were holding hostage escaped and called police, Kelly said. Later that night, police intercepted the brothers in a blazing gun battle that left 26-year-old Tamerlan Tsarnaev dead.

“We don’t know if we would have been able to stop the terrorists had they arrived here from Boston,” the mayor said. “We’re just thankful that we didn’t have to find out that answer.”

The news caused New Yorkers to shudder with the thought that the city may have narrowly escaped another terrorist attack, though whether the brothers could have made it to the city is an open question. They were two of the most-wanted men in the world, their faces splashed all over the Internet and TV in surveillance-camera images released by the FBI hours earlier.

Meanwhile, the search for evidence sent investigators combing through garbage at a landfill in New Bedford, Mass., as they hunted for a laptop computer belonging to one of the suspects, a law enforcement official said.

Investigators have been searching for several days for the laptop that they believe belonged to one of the two brothers suspected of setting off bombs at the marathon last week that killed three people and wounded more than 260, law enforcement officials said.

They believe that the computer may have been thrown out, and they searched a landfill near the University of Massachusetts, Dartmouth, where Dzhokhar Tsarnaev, 19, who was charged in the bombings this week, was a student.

If convicted, Dzhokhar could get the death penalty. Christina DiIorio-Sterling, a spokeswoman for U.S. Attorney Carmen Ortiz in Boston, would not comment on whether authorities plan to add charges based on the alleged plot to attack New York.

The Middlesex County district attorney’s office also is building a murder case against the surviving Tsarnaev for the death of MIT police officer Sean Collier three days after the bombings, office spokeswoman Stephanie Guyotte said.

Investigators and lawmakers briefed by the FBI have said the brothers were motivated by anger over the U.S. wars in Iraq and Afghanistan.

Based on the younger man’s interrogation and other evidence, authorities have said it appears so far that the brothers were radicalized via Islamic jihadi material on the Internet instead of any direct contact with terrorist organizations, but they warned that it is still not certain.

Dzhokhar was interrogated in his hospital room Sunday and Monday over a period of 16 hours without being read his rights to remain silent and have an attorney present. He immediately stopped talking after a magistrate judge and a representative from the U.S. attorney’s office gave him his Miranda warning, said a U.S. law enforcement official and others briefed on the interrogation.

Kelly and the mayor said they were briefed on the New York plot Wednesday night by the task force investigating the Boston bombing.

Rep. Peter King, R-N.Y., said in a CNN interview that the city should have been told earlier. “For all we know there could be other conspirators out there, and the city should have been alerted so it could go into its defensive mode,” he said.

Asked about the delay, Bloomberg said: “There’s no reason to think the FBI hides anything.”

Kelly, citing the interrogations, said that four days after the bombing, the brothers “planned to travel to Manhattan to detonate their remaining explosives in Times Square.”

“They discussed this while driving around in a Mercedes SUV that they hijacked after they shot and killed the officer at MIT,” the police commissioner said. “That plan, however, fell apart when they realized that the vehicle they hijacked was low on gas and ordered the driver to stop at a nearby gas station.”

A day earlier, Kelly said that Dzhokhar Tsarnaev had talked about coming to New York “to party.” But Kelly said a later interview with the suspect turned up the plot information. “He was a lot more lucid and gave more detail in the second interrogation,” Kelly said.

Kelly said there was no evidence New York was still a target. But in a show of force, police cruisers were lined up in Times Square, and officers stood shoulder to shoulder.

“Why are they standing like that? This is supposed to make me feel safer?” asked Elisabeth Bennecib, a tourist and legal consultant from Toulouse, France. “It makes me feel more anxious.”

The New York Times contributed to this report.