For at least a week, Anthony White, 21, a resident at a shelter in East Harlem, had frightened staff members and fellow residents with threats that he was going to kill someone, residents there said on Thursday.

Around midnight on Wednesday, the authorities said, a security officer at the shelter found Mr. White’s roommate, Deven Black, 62, on the floor, fatally stabbed in the neck. And on Thursday, the police were searching for Mr. White in the killing — a death that highlighted the surge in New York City’s homeless population, fears about shelter safety and concerns that the city was not doing enough to help the mentally ill.

Mr. White, who has a history of psychiatric problems, fled the Boulevard shelter on Lexington Avenue after the security officer opened the door of the room he was sharing with Mr. Black and saw Mr. Black bleeding on the floor, Robert K. Boyce, the Police Department’s chief of detectives, said. It was Mr. Black’s third night in the shelter.

Mr. Black was a respected teacher in the New York City public school system, beginning as a special education teacher in 2004 and spending much of his career in Bronx schools. In 2013, the Academy of Education Arts and Sciences honored him for his exceptional work as a school librarian. But in 2014, he was placed in the absent teacher reserve, a program for teachers who have lost their permanent teaching positions, according to city officials.