New York City and New Jersey dodged a bullet on Saturday.

The terrorist bombings allegedly perpetrated by Ahmad Khan Rahami, a 28-year-old naturalized U.S. citizen who was born in Afghanistan, could have been much worse.

Several of the bombs that he reportedly planted failed to explode, giving investigators important leads that enabled Rahami’s quick arrest.

Moreover, the placement of one of the bombs under a dumpster in Manhattan’s Chelsea neighborhood limited its lethal effects, resulting in 29 injured victims, but no deaths.

Another bomb hidden in a trash can in Seaside Heights, New Jersey, near the location of the Semper Five Marine Corps Charity 5K race failed to injure anyone, in part because the start of the race was delayed.

Police and the Federal Bureau of Investigation are still investigating if Rahami had any help in making and placing the bombs or any ties to terrorist groups.  His motivation and some of his intended targets also remain a mystery.

Rahami was not listed on U.S. counterterrorism databases, but came to the attention of the FBI in 2014, when he was arrested for stabbing his brother in a domestic dispute and his father told police that he was a “terrorist.”

When FBI agents later questioned Rahami’s father about the allegation, the father recanted and told them that he was angry at his son when he made the comment. The FBI has been criticized for not subjecting Rahami to a fuller investigation, but given the surging number of young Muslims attracted to Islamist extremist causes, it has been stretched thin and forced to focus scarce resources on the most urgent cases.

Rahami’s prior arrest may have enabled law enforcement authorities to quickly identify him as the suspected bomber when a fingerprint was found on an unexploded bomb.

Rahami traveled to Afghanistan and Pakistan in 2011, when he married a Pakistani woman.  He also spent almost a year in Pakistan, and visited Afghanistan again, from April 2013 until March 2014.  It is not known who he may have met with during those visits or if he came into contact with members of terrorist organizations there.

The references to Anwar al-Awlaki in Rahami’s notebook indicate that al-Qaeda’s poisonous ideology remains a potent force for inspiring terrorist attacks five years after Awlaki’s death.

Rahami is not cooperating with police. But his wife, who flew out of the country shortly before the attack, reportedly is cooperating with U.S. officials who have met with her in the United Arab Emirates.

Police reported that when he was arrested Monday, Rahami had a notebook in which he had written rambling thoughts about terrorists, including Osama bin Laden, the al-Qaeda leader killed in 2011, and Anwar al-Awlaki, the charismatic Yemeni-American Islamist extremist who was a key leader of al-Qaeda in the Arabian Peninsula before he was killed in a U.S. drone strike in Yemen in 2011.

Awlaki inspired or encouraged many terrorist attacks inside the United States. Terrorists known to have been influenced by Awlaki have launched scores of attacks.

These attacks include the 2009 shootings at Fort Hood by Maj. Nidal Hasan that killed 13 people; the botched 2009 Christmas Day attack by the “underwear bomber” who sought to crash a jetliner over Detroit; the failed attempt to detonate a car bomb in New York’s Times Square in May 2010; the April 2013 bombing of the Boston Marathon that killed three people and injured over 260; the July 2015 fatal shootings of four Marines and a Navy sailor at a military recruiting office in Chattanooga, Tennessee; the December 2015 terrorist attack in San Bernardino, California, that killed 14 people; and the June 2016 shootings of 49 people in a gay nightclub in Orlando, Florida.

Awlaki also inspired the terrorists who attacked the Charlie Hebdo magazine offices and a Jewish grocery store in Paris in January 2015, killing 17 people.

Awlaki also was known to be a close associate of at least two of the 9/11 hijackers and served as their “spiritual guide” while he served as a preacher at mosques in San Diego and Falls Church, Virginia.

Awlaki left the United States in 2002 and spent two years preaching jihad in Great Britain before moving to Yemen in 2004.  In Yemen, he received the protection of his father’s kinsmen, the powerful Awlaki tribe, which also counted bin Laden’s father as one of its members.

>>> Awlaki Death: Another Blow to Al-Qaeda

The pressure cooker bombs found in New York City were similar to the pressure cooker bombs that the Tsarnaev brothers used to attack the Boston Marathon on April 15, 2013.  The surviving brother, Dzhokhar Tsarnaev, later admitted they had found instructions for building the bombs in Inspire, the online newsletter published by Awlaki’s terrorist group, al-Qaeda in the Arabian Peninsula.

Rahami may have learned how to construct his bombs in the same manner. Or he may have received training from another source, perhaps on one of his visits to Afghanistan or Pakistan.

The Islamic State has not claimed responsibility for the New York/New Jersey bombings, although it did quickly claim that the Somali-American involved in the stabbing attacks at a Minnesota shopping mall that same day was acting as a “soldier of the Islamic State.”

FBI Assistant Director William F. Sweeney Jr. said there is “no indication” of an active terrorist cell operating in the New York area, but sources also have told CNN that evidence suggests that Rahami was not acting alone.

If he did have help, it is curious that he was found sleeping in a doorway of a bar in Linden, New Jersey, when he was found by police. That suggests Rahami’s actions were not well planned or adequately supported.

The fact that several bombs failed to detonate and that some were poorly placed to inflict maximum casualties suggests a lack of competence, which could be a sign of a “stray-dog” (or “lone-wolf”) attack. If Rahami was part of a broader conspiracy, then he may have been a useful idiot who was abandoned after the attack.

But the references to Awlaki in Rahami’s notebook indicate that al-Qaeda’s poisonous ideology remains a potent force for inspiring terrorist attacks five years after Awlaki’s death.

>>> Top 4 Homeland Security Priorities for the Next Administration

This article has been modified since it was originally published.