When Ahmad Khan Rahami returned in March 2014 from a nearly yearlong trip to Pakistan, he was flagged by customs officials, who pulled him out for a secondary screening. Still concerned about his travel, they notified the National Targeting Center, a federal agency that assesses potential threats, two law enforcement officials said.

It was one of thousands of such notifications every year, and a report on Mr. Rahami was passed along to the F.B.I. and other intelligence agencies.

Five months later, when Mr. Rahami’s father told the police after a domestic dispute that he was concerned about his son having terrorist sympathies, federal agents again examined his travel history. And again, despite Mr. Rahami’s now having been flagged twice for scrutiny, the concerns were not found to warrant a deeper inquiry, one of the law enforcement officials said. Ahmad Rahami was not interviewed by federal agents.

But now, the travel history of Mr. Rahami, who is accused of carrying out bombings in New York and New Jersey last weekend, has become a focus of investigators, a subject made all the more urgent by details contained in a notebook that suggests he drew inspiration largely from the Islamic State.