The F.B.I. said on Thursday that a gunman acted alone when he shot and killed three people and injured 15 others in an Austin bar, though the attack in March may have been prompted by “specific personal triggers and grievances” related to the Iran War.

The gunman, Ndiaga Diagne, 53, of Senegal, died after exchanging gunfire with police officers who responded to the shooting near a busy stretch of downtown Austin.

Mr. Diagne had not been investigated by the F.B.I. before the shooting and there was no evidence that showed he was connected to a foreign terrorist organization, the agency said.

During the shooting, Mr. Diagne wore a shirt with an Iranian flag design and a sweatshirt that said “Property of Allah,”, according to the F.B.I. He also “admired” the late Iranian ruler, Ayatollah Ali Khamenei, the bureau added.

“While Diagne’s affinity for Iran and the Ayatollah were most certainly factors in his mobilization to violence,” the agency said, “the F.B.I. has not identified conclusive evidence to explain Diagne’s motivation or how and why he selected the location for his attack.”

Officials said that Mr. Diagne, who became a naturalized U.S. citizen in 2013 and was living in the Austin area at the time of the shooting, had legally purchased a handgun in August 2017 and a rifle in October of that same year. Both weapons were used in the shooting on March 1, the F.B.I. said.

The update on the investigation offered some insight over what may have prompted Mr. Diagne to carry out the attack. The shooting happened about a day after the U.S. and Israel launched military strikes against Iran, which led to speculation about Mr. Diagne’s life and whether he was motivated by the attacks.

Mr. Diagne flew to New York through Kennedy International Airport in March 2001, according to a law enforcement official. He worked for a time as a taxi driver in New York, obtained a green card, became a citizen and eventually moved with his wife and two children to Texas. There, it appeared his life began to unravel.

In January 2020, Mr. Diagne’s wife, Aissatou Savare, called the county sheriff’s office to report an alleged assault. She told officers that Mr. Diagne had one of their children in his car and would not allow her to hug the child. According to authorities his wife said, “Diagne then threatened to ‘kill her in the city’ and also beat her with the steering wheel locking tool if she attempted to hug the child again.” Ms. Savare declined to press charges and said she made the call to the sheriff’s “for her records and documentation purposes.”

In October 2022, Mr. Diagne reportedly called a crisis center in New York and “made a threat of harm to himself.” The dispatcher there contacted law enforcement in Texas, who sent officers to the San Antonio address, though Mr. Diagne had apparently sold the home two years prior. The then-homeowner said she only knew Mr. Diagne’s name from mail that sometimes arrived at the address, and that she had not spoken to him in a year.

It is unclear whether the sheriff’s office in Bexar County, which includes San Antonio, followed up on the call.

In September 2022, about a month before Mr. Diagne called the crisis center, court records show that the divorce between he and Ms. Savare was finalized after he failed to appear at a hearing in Bexar County. Mr. Diagne lost custody of his two young boys.

In finalizing the divorce, a state civil court judge found that Mr. Diagne had a “history or pattern of committing family violence” in a two-year span before the divorce was filed.

Ms. Savare and several family members did not respond to calls for comment. A lawyer who represented Ms. Savare during the divorce proceedings also did not respond to a request for an interview.

Miles G. Cohen contributed reporting from New York, and Edgar Sandoval from San Antonio.