Ahmad Khan Rahimi, a 29-year-old Afghan-American from New Jersey who mused about waging jihad on the streets of America in his diary, faces a mandatory life sentence after being convicted Monday in Manhattan federal court of a Chelsea bomb attack last year that injured 30.

Rahimi’s lone-wolf attacks, leaving explosives near the site of a charity race in his home state as well as planting two bombs in the heart of Manhattan, put the region on edge last fall until he was caught in a shootout near his hometown 50 hours later.

The jury’s verdict was quickly celebrated by officials.

“Rahimi’s crimes of hate have been met with swift and resolute justice,” said Acting Manhattan U.S. Attorney Joon Kim. “Today’s verdict is a victory for New York City, a victory for America in its fight against terror and a victory for all who believe in the cause of justice.”

“The Chelsea bombing was an attempt to bring our city to its knees,” said Mayor Bill de Blasio. “His evil was met with the bravery and resiliency of a beautiful neighborhood and an entire city. New York City will never be intimidated.”

According to evidence at trial, Rahimi of Elizabeth, New Jersey, who worked in his family’s fast-food business, began his terror spree the morning of Sept. 17, 2016 by planting a bomb on the route of a charity 5K race in Seaside Park, New Jersey. The bomb exploded when runners would have been passing but for a delay in the start of the event.

That evening at 8:30 p.m. the first of two pressure-cooker bombs planted in Chelsea exploded on West 23rd Street. Packed with ball bearings, the bomb caused injuries ranging from facial lacerations to embedded shrapnel across a 650-square-foot crime scene, crumpled and catapulted a nearby dumpster across the street, and shattered windows three-stories high and 400 feet away.

The second bomb, with a cellphone timer, was left on West 27th Street in a suitcase across from a busy restaurant, authorities said. Two passersby took the suitcase and, unwittingly, removed the bomb, leaving it on the sidewalk where a neighbor spotted it. Police eventually defused the device.

“The fact that victims were not killed when one bomb exploded and another failed to detonate is miraculous,” NYPD Commissioner James O’Neill said following the verdict.

Two days after the spree began, Rahimi was identified and cornered in Linden, New Jersey, where he was captured after a shootout in which he allegedly shot an officer in the torso, hitting him in a protective vest, and was himself wounded multiple times.

Rahimi was impassive when verdicts of guilty for the Manhattan bombs were read Monday. His sentencing was set for Jan. 18, and his public defender said an appeal would be filed. He still faces separate federal charges in New Jersey, and a state case stemming from the shootout.

Most jurors declined to comment as they left court.

“It’s always difficult to work on this kind of case,” said the foreman, who requested anonymity. “It’s never easy for anybody to be part of.”

Prosecutors at trial leaned on a journal in which Rahimi expressed admiration for figures like Osama bin Laden and jihadist sentiments — “The sounds of bombs will be heard in the streets” he said in one passage — and on bomb-making instructions from al-Qaida’s “Inspire” magazine found on his laptop.

More than a dozen witnesses were called by prosecutors to offer emotional testimony about the injuries and terror they suffered and damage they witnessed on West 23rd Street. Prosecutors also showed dozens of security-camera videos of Rahimi pulling two suitcases with the bombs inside around Manhattan and wearing a backpack allegedly containing six pipe bombs he didn’t use.

Rahimi was linked to the bombs by DNA, fingerprints, and evidence of purchases of some of the components, such as ball bearings used as shrapnel.

He started the trial by standing and trying to speak to U.S. District Judge Richard Berman out of turn about restrictions on visitation with his family, and was escorted from court in front of the jury.

After that, he was well-behaved. His defense lawyer didn’t actively contest Rahimi’s link to the 23rd Street bomb, but argued that the government didn’t prove he tried to detonate the one he left on West 27th Street.

If that argument had succeeded, the life sentence would not have been mandatory.