When Lee Parker found a backpack near the Elizabeth train station Sunday night, he thought it would be useful for storing food.

The homeless man, who is looking for a job as fork lift operator, thought it was free to take because it was on top of a trash can.

"When I noticed the bag I said, 'This is fine, I can have this for work, I can put my lunch in it,' " Parker, who was walking with his friend Ivan White at the time, told CBS2 in New York.

That bag turned out to be filled with pipe bombs, allegedly planted there by Ahmad Khan Rahami, who is also accused of setting off explosives in Manhattan's Chelsea neighborhood and along the route of a 5K race in Seaside Park, N.J.

Parker and White were alarmed by the backpack's contents.

"I said 'We need to go to the police station right now because this is a bomb,' " Parker told New York's ABC7. "It wasn't the cartoon bomb with a tick-tock tick-tock clock but it had wires. I had seen enough pictures of pipe bombs and different devices in books, magazines. I knew what I was looking at as soon as I saw it."

A local nonprofit has set up a GoFundMe page to collect money for Parker, White (who said he lives on a fixed income), and the Elizabeth Coalition for the Homeless.

"Had it not been for these heroes, Elizabeth, New Jersey, would have experienced a devastating terrorist attack," the nonprofit, At Heart's Length, said on its website. "Thanks to Ivan White and Lee Parker, that explosion did not happen. We owe them a debt of gratitude."

Christian Bollwage, Elizabeth's mayor, told DNAinfo that the pair prevented a tragedy by taking the bag to police right away.

"People go through life on the edge in a very difficult position yet they probably saved hundreds of lives," the mayor said.