Before the virus overwhelmed the hospitals of New York, before it changed how Americans went about their daily lives, James “Charlie” Mahoney was planning for his retirement.

He had just gone on a Caribbean cruise with his family, a January vacation that his sister, Saundra Chisholm, said was part-62nd birthday celebration, part-early retirement party. He had been working in the intensive care unit at the SUNY Downstate Medical Center for nearly four decades, caring for patients through the HIV/AIDS epidemic, through 9/11, through the swine flu and now he felt like it was finally time to take it easy.

“And then covid hit,” Chisholm said.

His family insisted he follow through on retirement, including his brother Melvin Mahoney, who is also a doctor. His boss, Robert F. Foronjy, said doctors, especially those who were older or at higher risk of suffering complications from the novel coronavirus, were given the opportunity to step back.

But James Mahoney refused. And to some extent, his colleagues and family knew he would.

“He gave everything to that hospital,” Melvin Mahoney told The Washington Post. “He gave his life for that hospital.”

Before it came for him, Mahoney witnessed the toll of the virus in his patients in the ICU — not just at SUNY Downstate but also across the street at Kings County Hospital Center, where he also took on shifts. Sometimes he slept there, his brother said. Mahoney had new coronavirus patients needing critical care every hour, an onslaught of suffering that was unlike anything he and his team had ever seen, Foronjy said.

He worked on his patients until he couldn’t anymore, in mid-April, when the telltale fever crept up on him. It never got better.

The 62-year-old died of the virus on April 27, with his dearest colleagues — his second family — at his side. From the time he brought himself to the emergency room, suffering from shortness of breath, he was treated by his colleagues in the same hospital where he had worked and studied since 1982, starting as a medical student. He ultimately died at Tisch Hospital, which had more sophisticated blood-oxygenation equipment, and where Foronjy and four of his other closest colleagues personally escorted him from Brooklyn to Manhattan traveling in two ambulances.

“There are two hospitals crying. Nonstop,” Melvin Mahoney said of the two where his brother worked. “I’ve heard men crying like you wouldn’t believe. That’s how much they loved my brother.”

Mahoney is survived by three children, four siblings, his father and a longtime girlfriend, a nurse. He is the latest health-care worker to die on the front lines in New York, the pandemic’s epicenter, where last month 911 call volume exceeded that of Sept. 11, 2001. He is not even the only health-care worker in his family to contract the virus. Chisholm, who works as a nurse overseeing employee health at St. John’s Episcopalian Hospital, also had the virus in April.

Foronjy said Mahoney’s death has been crushing. He was the “heart and soul” of their department, “an institution in and of himself,” Foronjy said. He befriended seemingly everyone at the hospital, from the gift-shop cashier to the taxi drivers waiting outside. Even the janitors called him “Charlie,” a name only his friends called him, said his brother.

“We were all his relatives,” Foronjy said. “He was a very openhearted person, really emotionally accessible to people as well, which is one of the reasons a lot of us are having a hard time coping with this. It just seems so unjust that someone who was this benevolent, this selfless, this kind, this skilled could be brought down by this disease.”

Foronjy created a GoFundMe intended to finance tuition for an aspiring African American doctor, an effort to carry on his friend’s legacy. He was a mentor to both colleagues and trainees, but his advice resonated particularly with black medical students who looked up to him. One told the New York Times that he and other black aspiring doctors viewed him as a legend — “our Jay-Z.”

“As a young black man, I looked at this guy and said to myself, ‘Twenty years from now I want to be like him,’ ” Latif A. Salam, a doctor who works in internal medicine at SUNY Downstate, told the Times on Tuesday.

James Mahoney was born in Garden City, N.Y., in 1958 and grew up near the former Mitchel Air Force Base on Long Island, where his father served in the Air Force. Even from a young age, his work ethic was strong. By the time he was 8, he was working at a deli and luncheonette with his older brother Melvin.

A skilled athlete, Mahoney wanted to be a baseball player as a teenager, Melvin said. But he set his sights on becoming a doctor while accompanying Melvin on a trip to a Long Island hospital. He started as a medical student at SUNY Downstate in 1982.

He never turned back.

Chisholm said that as Mahoney rose in his career, he had numerous opportunities to move to larger or wealthier hospitals elsewhere. SUNY Downstate, a largely underfunded state-run hospital, serves low-income, minority neighborhoods in Brooklyn.

But Mahoney never wanted to go.

“It was like he was born and raised in that hospital,” Chisholm said. “He went to medical school there. He did his residency there. He was chief resident there. He did a fellowship there. And then he started to practice there.” Eventually, she said, it always seemed like going to the hospital “really didn’t seem like work to him. It was part of him.”

Foronjy said his personality was larger than life — a cross between the late comedian Bernie Mac and Gregory House, the fictional doctor from the television show “House.” He knew exactly when to offer support and when to demand better from trainees, his boss said. And if anyone ever stepped out of line, his siblings said, Mahoney was not one to mince words to let them know.

“He was like a good coach on a baseball team and a football team,” Foronjy said of Mahoney, who actually was a former baseball and football coach. “He knew how to press people’s buttons to get the best out of them."

Foronjy barely recognized the man who arrived at the emergency room on April 20.

Mahoney was struggling to breathe. He could barely walk. As the days went by, Mahoney’s condition deteriorated even as he insisted to his family and his friends at the hospital that he was feeling better. He flashed a thumbs-up on a FaceTime call, Chisholm said, even as he could barely speak.

But his family found comfort knowing Mahoney did not have to battle the virus alone, like so many tens of thousands of people who have died without loved ones or friends present in hospital rooms nationwide. He knew and trusted every person taking care of him.

“I was able to hold his hand, tell him how much I loved him, how much everybody loved him,” Foronjy said.

Until the very end, Mahoney insisted he did not want to leave the hospital, even to go to Manhattan for more sophisticated machines.

As he was surrounded by his colleagues in the place where he had always been, Chisholm said, he told his girlfriend right before he died, “I’m home.”