A man suspected in a series of bombings in New York and New Jersey this weekend that left more than two dozen people injured was caught when police in a nearby city were called about a vagrant sleeping in a doorway, authorities said.

A reporter for CBS New York shared that detail of 28-year-old Ahmad Khan Rahami's capture on Twitter. Rahami, a naturalized citizen born in Afghanistan, engaged in a shootout with police, in which both he and a Linden, New Jersey, police officer were injured, New York's NBC affiliate reported.

A second tweet from a CBS editor said that the injured officer recognized Rahami, whose face had hours before been plastered on a wanted poster by the FBI. The officer told Rahami to show his hands and the suspect fired a shot that struck him in the vest.

NBC New York said the unnamed officer's injuries are not life-threatening. A second officer was injured by glass shrapnel, the news station reported.

Rahami was taken to a hospital for treatment of his own wounds. Linden Mayor Derek Armstead told NBC New York that the suspect was shot in the leg.

Rahami is a suspect in bombings Saturday night in a Manhattan neighborhood and a Jersey shore town. The NBC station reported that investigators are also trying to determine if he is linked to five pipe bombs found Sunday at a train station in Elizabeth, New Jersey, not far from where Rahami was later captured.

The Manhattan bombing, which occurred in the Chelsea area, injured 29 people, but none seriously. A second unexploded pressure cooker bomb was found four blocks away from the scene, NBC New York reported.

A pipe bomb was also found in a trash can at the Marine 5K in Seaside Park, New Jersey. Investigators have said that they believe the bomb had been timed to go off as runners went past the trash can, but the race started late. It was ultimately canceled.

A fingerprint on one of the unexploded bombs helped lead investigators to Rahami as a suspect, the news station reported.