ELIZABETH -- Two homeless men found the backpack with the five pipe bombs in the city Sunday and saved lives by reporting it to police, Mayor Christian Bollwage said.

"They probably saved hundreds of people," Bollwage said.

Ahmad Khan Rahami, of Elizabeth, was arrested after a shootout with police.

Bollwage said the men were also fortunate the bombs did not explode when they discovered the backpack and began carrying it around 8:15 p.m. Sunday.

"They were walking with angels. They carried this (backpack) 800 to 1,000 yards before they dropped it," Bollwage said.

He said the men at first thought there was something valuable in the backpack until they saw all the wires inside.

Bollwage made his comments while standing across the street from a fried chicken restaurant where Ahmad Khan Rahami worked. Rahami was arrested Monday after a shootout with police in Linden that left two officers wounded.

Rahami was also shot in the exchange of gunfire. The FBI identified Rahami early Monday as the suspect in the New York City bombing that injured 26 and the explosion at a military 5K event in Ocean County.

Bollwage said police are speculating that the bomb maker had discarded the backpack found in Elizabeth to get rid of evidence as he was fleeing the city. One of the bombs inside the backpack detonated as a robot investigated the device.

The mayor said he learned about 3:30 p.m. Sunday that authorities investigating Saturday's bombing in the Chelsea section of New York City had found a connection to Elizabeth.

Tom Haydon may be reached at thaydon@njadvancemedia.com. Follow him on Twitter @Tom_HaydonSL. Find NJ.com on Facebook.