A federal jury on Monday swiftly convicted a man inspired by the Islamic State and al Qaeda of planting bombs on the streets of Chelsea in a September 2016 attack that injured 30 people in a hail of shrapnel and blown-out windows.

After a little more than four hours of deliberations, the jury in the U.S. District Court for the Southern District of New York convicted Ahmad Khan Rahimi of eight counts, including using a weapon of mass destruction and bombing a public place. The verdict followed a two-week trial that also charged Rahimi with setting up and leaving pipe bombs in Seaside Park, New Jersey, and Elizabeth, New Jersey.

“On Sept. 17, 2016, Ahmad Khan Rahimi attacked our country and our way of life,” Acting Manhattan U.S. Attorney Joon Kim said in a statement released this morning. “Inspired by ISIS and al Qaeda, Rahimi planted and detonated bombs on the streets of Chelsea, in the heart of Manhattan, and in New Jersey, hoping to kill and maim as many innocent people as possible. Rahimi's crimes of hate have been met with swift and resolute justice.”

Rahimi, a 29-year-old from Afghanistan who was living a mostly solitary life in Elizabeth, faces a mandatory life sentence. His sentencing is slated for Jan. 18.

As the jury announced its guilty verdict, Rahimi, wearing a wrinkled blue shirt, stared straight ahead and at the jurors themselves, showing little emotion. It was in contrast to the trial's first day when he suddenly yelled out in court about his wife not having clearance to visit him while he was in custody.

Over two days in September 2016, Rahimi went on a bomb-hiding and detonation spree that spanned two states and included both pressure-cooker and pipe bombs. A lone-wolf attacker inspired by internet calls for jihad, he toted around nine bombs in all. Most ultimately did not explode.

He began by setting up a pipe bomb in a trash can near the finish line of a U.S. Marine Corps charity race in Seaside Park. No one was harmed when the bomb went off.

Later the same day he traveled through Manhattan's Penn Station and walked through Chelsea. He set up two pressure-cooker bombs on crowded streets on a warm summer evening. One exploded on 23rd Street, throwing a Dumpster 120 feet into the air, shattering windows and injuring 30 people. The fact that no one was killed, according to prosecutors, amounted to a miracle.

The same evening, a passersby discovered a bomb on a different Chelsea street. It was later disarmed by the police bomb squad. The following day, Rahimi returned to New Jersey and left six pipe bombs in a backpack at a local train station. A bomb squad was able to handle the bombs without incident.

That the jury came back quickly with a unanimous verdict on Monday morning, after closing arguments wrapped on Friday, came as little surprise to observers of the trial.

In his closing, Assistant U.S. Attorney Emil Bove pointed to a large amount of evidence against Rahimi.

His fingerprints and DNA were found on bombs. Video cameras in Manhattan had tracked his movements as he hauled bombs in suitcases through Chelsea, and they showed the explosion on 23rd Street in Chelsea that injured 30 people.

In addition, there was a notebook for jurors to review. It was found on Rahimi when he was arrested after the attack following a shootout with New Jersey police.

The prosecutor said Rahimi's words provided a confession as he took responsibility for the bombings in a “claim of credit” for the attacks.

Assistant public defender Sabrina Shroff did not deny evidence linking Rahimi to the 23rd Street bomb that exploded, but asked jurors to consider whether Rahimi intended for the unexploded 27th Street bomb to go off.

She asked the jury to acquit Rahimi of three charges that could result in a mandatory life prison sentence.

After the verdict was announced Monday, the defense promised to appeal.

Rahimi also still faces separate charges in New Jersey tied to the shootout.

The Associated Press contributed to this report.