NEW YORK — Law enforcement agencies are searching for two men who apparently stumbled on one of the bombs planted in Manhattan on Saturday evening and took the explosive device out of a bag before walking away with the bag.

On Wednesday, investigators, who believe the bag may be a valuable piece of evidence, released images of the men — one wearing a pink golf shirt and the other wearing a light brown button-down collared shirt. The images were taken from surveillance video that shows them walking on 27th Street between Avenue of the Americas and Seventh Avenue in the Chelsea section of Manhattan between 8 and 9 p.m. Saturday.

In an image provided by the FBI, two men who apparently happened upon one of the bombs planted in Manhattan on the evening of Saturday, Sept. 17, and walked away with the bag, leaving the device. Authorities do not believe the men are connected to Ahmad Khan Rahami, the accused bomber, but say the still-missing bag could be valuable evidence. (FBI via the New York Times)
In an image provided by the FBI, two men who apparently happened upon one of the bombs planted in Manhattan on the evening of Saturday, Sept. 17, and walked away with the bag, leaving the device. Authorities do not believe the men are connected to Ahmad Khan Rahami, the accused bomber, but say the still-missing bag could be valuable evidence. (FBI via the New York Times)

Authorities said they did not believe the men were connected to Ahmad Khan Rahami, who is charged with setting off powerful bombs in New York and New Jersey.

"We have no reason to believe they're connected," Chief James Waters, head of the New York Police Department's Counterterrorism Bureau, said at a news conference Wednesday morning.

The police commissioner, James P. O'Neill, said they were considered "witnesses."

In fact, several law enforcement officials suggested that the men might have inadvertently prevented even greater carnage, perhaps jostling the bomb when they removed it and causing it to fail to explode.

In a criminal complaint against Rahami filed in federal court Tuesday evening, prosecutors outlined a terrorism campaign that they said was carefully planned and motivated by Islamic extremism.

When Rahami was shot and taken into custody, he was carrying a notebook in which he praised "Brother Osama bin Laden" and other well-known international terrorists, according to the complaint. In the notes, he vowed that the echo of bombs would ring through city streets.

Prosecutors say Rahami succeeded in setting off two explosions, one Saturday morning in Seaside Park, New Jersey, and another 11 hours later on 23rd Street in Chelsea, a bomb that injured 31 people. Given the strength of the explosion, with bomb fragments found 650 feet from the blast site, officials said it was miraculous that no one was killed.

The U.S. attorney general, Loretta E. Lynch, said Wednesday that the government would bring Rahami to New York to face charges.

"In the near future, it is our intention to bring the defendant to the Federal District Court for the Southern District of New York," she said in remarks made in Washington.

Rahami is recovering in New Jersey from wounds he sustained in a shootout with police Monday morning, when he was taken into custody.