WASHINGTON — Times Square bomb suspect Faisal Shahzad bought a gun in Connecticut two months ago, about the time he put his attack plan in motion, New York Police Commissioner Raymond Kelly said Wednesday.

Kelly told a Senate hearing that Shahzad drove to John F. Kennedy International Airport with the gun, which was discovered in his vehicle.

"It appears from some of his other activities that March is when he decided to put this plan in motion," Kelly said. "He came back from Pakistan Feb. 3, 2010. It may well have been an indicator of putting something catastrophic in motion."

Shahzad was hauled off a Dubai-bound plane Monday night, after he was allowed to board despite being under surveillance and placed on the federal no-fly list.

"We know he purchased a weapon in Connecticut in March," Kelly told a hearing of the Senate Homeland Security and Governmental Affairs Committee.

Kelly also said the hidden vehicle identification number on the suspect's SUV was crucial to identifying Shahzad, while databases were key to linking telephone numbers that led authorities to the suspect.

In Connecticut, Shelton Police Chief Joel Hurliman said Shahzad had passed a criminal background check and legally bought a gun from a dealer in his former hometown.

Hurliman said the owner of Valley Firearms confirmed Shahzad bought a Kel-Tec rifle and passed a 14-day waiting period. The shop owner declined to comment when contacted Wednesday by The Associated Press.

"He said he wanted me to know he had sold him the firearm and I should be aware of it," Hurliman said. "It was a courtesy call."

The chief said the owner did not indicate how Shahzad behaved.

"I'm sure if there was any kind of suspicion on his part he wouldn't have sold to him," Hurliman said.

The 30-year-old son of a retired official in Pakistan's air force, Shahzad was charged Tuesday with trying to blow up a crude gasoline and propane device inside the parked SUV amid tourists and Broadway theatergoers.

Sen. Frank Lautenberg, D-N.J., and Rep. Peter King, R-N.Y., have introduced legislation that would give the attorney general authority to deny guns and explosives to known and suspected terrorists.

A gun owner who objected to an attorney general's finding could challenge the ruling.

Kelly and New York Mayor Michael Bloomberg testified Wednesday in favor of the legislation.

According to the criminal complaint filed Tuesday, Shahzad drove a black Isuzu Rodeo with tinted windows in April to a Bridgeport, Conn., parking lot to purchase the Pathfinder he admitted driving into Times Square, the complaint said.

He fled to the airport Monday from Connecticut after becoming spooked by news reports that authorities were seeking to arrest a man of Pakistani descent in Connecticut, two people familiar with the probe told The Associated Press on Tuesday.

Asked about lessons learned from the failed bombing attempt, Bloomberg said that preparation for such an incident paid off: Street vendors were vigilant and responders reacted according to their training.

He praised first responders for quickly moving people from the area and the fire department for their rapid response.

And he warned that more attacks will certainly occur in New York.

"We are a target. We are going to be a target again," he said.

Kelly said the investigation "was clearly a team effort" between city and federal authorities. "We worked seamlessly on this case. The relationship is strong and a very productive one as this investigation showed."

____

Associated Press writers Tom Hays and Colleen Long in New York and John Christoffersen in New Haven contributed to this report.