Fresh out of medical school in the Caribbean, Henry Bello took the first job he could get on the road to working as a doctor: a pharmacy technician with the city’s Health and Hospitals system. Then, in 2014, he got his break, when Bronx-Lebanon Hospital Center took a chance on the sharp dresser from California, someone who, in his 40s, was arriving late to the profession. He was hired to be what the hospital described as a “house physician.”

With a limited permit from New York State to practice medicine as an international medical graduate, Dr. Bello was essentially an extra pair of hands for the department of family medicine at the 17-story hospital, one of the biggest and busiest in New York City. Dr. Sridhar Chilimuri, the hospital’s physician in chief, said Dr. Bello could treat patients and prescribe medication, as long as other doctors were looking over his shoulder, and only at Bronx-Lebanon. “Not over there — not in a clinic,” he said for emphasis, pointing out the hospital’s doors.

But Dr. Bello’s slow journey to the medical profession, which was punctuated by bankruptcy, at least two arrests and recent sojourns in homeless shelters, came to a shattering end on Friday, when he opened fire with an assault rifle on the 16th and 17th floors of the hospital. After killing one doctor and wounding six other people, he fatally shot himself in the head.

Exactly how — and why — Dr. Bello, 45, wound up sneaking an AM-15 under his lab coat on a sultry afternoon and inflicting mayhem is the subject of a wide-ranging police investigation, and is marked with as many questions as answers. But through records, accounts from hospital officials and interviews with former neighbors, a portrait is coming into focus of someone who strained to achieve professional success while dogged by financial troubles and possibly addiction.