BATTER UP! GET 6 MONTHS FOR $19.99

Hours after engaging in a gun battle with police, the suspect in a series of blasts in New York and New Jersey was charged with five counts of attempted murder of a law enforcement officer.

Ahmad Khan Rahami, 28, was charged Monday evening in New Jersey.

The prosecutor's office also charged him with second-degree counts of unlawful possession of a weapon and possession of a weapon for an unlawful purpose. A state judge set bail at $5.2 million.

Rahami, who could face up to 20 years for each count of attempted murder of a law enforcement officer, was taken into custody after he was shot in the leg during the 10:30 a.m. confrontation in Linden, N.J., law enforcement sources said.

Rahami shot one officer in the hand and another in his bulletproof vest before he was apprehended, police said.

None of the injuries to the officers or the suspect were considered life-threatening.

Rahami was captured after police got a call about a man sleeping in the doorway of a local bar, authorities said.

Police said he is the man seen in surveillance footage taken Saturday night in Manhattan's Chelsea neighborhood, the site of an explosion that injured 29 people.

The blast was so powerful that it sent a dumpster flying more than 150 feet down the sidewalk and shattered windows more than a block away. Police later found a second bomb that did not detonate a few blocks away on 27th Street.

The FBI said it does not yet know why the Chelsea neighborhood was targeted.

Other physical evidence links Rahimi to the pressure cooker bombs that went off or were found in New York and New Jersey, a senior law enforcement official said.

Rahami, who is a U.S. citizen, was identified as a suspect after a fingerprint was found on one of the devices that failed to detonate.