The two knew each other through Binghamton’s graduate program, where the professor served on the dissertation committee for Mr. Zahrani, who is from Saudi Arabia.

Image Prof. Richard T. Antoun was supervising the work of Mr. al-Zahrani. Credit... Binghamton Press & Sun-Bulletin

On Sunday, Mr. Zahrani’s roommates  who had lived with him for about three weeks in a three-bedroom apartment in downtown Binghamton  recounted how the suspect, who spoke of financial problems, often mentioned death and said he was being persecuted because he was Muslim.

“I said he was acting oddly, like a terrorist,” said one of the roommates, Souleymane Sakho, a graduate student from Senegal. “When I informed them, it was for them to understand that the guy was violent or he may be violent.”

Mr. Sakho said that he told his academic adviser who is overseeing his dissertation about Mr. Zahrani, and that the adviser referred him to the school’s counseling center. Mr. Sakho said that the head of the counseling center told him to avoid interaction with Mr. Zahrani and said he should look to move out of the apartment.

A spokesman for Binghamton University declined to comment on what university officials may have been told by Mr. Sakho about Mr. Zahrani’s behavior, citing a continuing investigation by the district attorney of Broome County.