Edward B. Guy, 97, of Philadelphia, a former psychiatrist and medical director of the Philadelphia Prison System; faculty member at the University of Pennsylvania, Hahnemann Hospital, and Temple University; veteran of both the U.S. Navy and Air Force; and a sailmaker, winemaker, and pajama maker, died Friday, Aug. 20, of bile duct cancer at his home at the Atria Center City retirement community.

Dr. Guy was the medical director of the city prison system in the 1970s and 80s. An expert in forensic psychiatry who interviewed prisoners to determine if they were competent to stand trial, he evaluated murderers Gary Heidnick and Sylvia Seegrist, sexual predator Ed Savitz, and others as a prelude to their court appearances.

Compassionate and articulate, Dr. Guy and coauthors Melvin S. Heller and Samuel Polsky published a paper in the Prison Journal in April 1969, “Disposition of Mentally Ill Offender,” that addressed their concerns regarding the mental health and criminal justice systems.

They wrote, “The mentally ill offender deserves the best possible psychiatric care and treatment, particularly when involved in criminal litigation; and society deserves the very careful appraisal and management of his potential dangerousness.”

Dr. Guy was at Holmesburg Prison on May 31, 1973, and aided warden Patrick N. Curran and deputy warden Robert E. Fromhold Sr. after they were stabbed by two inmates. Both men died.

At Penn, he met and befriended Dr. Aaron T. Beck, the father of cognitive therapy and cognitive behavioral therapy.

“He was a very smart man who was interested in so many things,” said Jon Crane, his stepson. “He liked doing stuff.”

Among those things were sailing, making wine, and creating clothes. After learning to make sails for boats as a young man on the Chesapeake Bay, he later made ties, vests, and cummerbunds in his basement that his second wife sold to high-end stores.

In December 1999, he was featured in The Inquirer for hand-making pajamas and nightgowns for each of his 11 grandchildren at Christmas. Flashing his well-known sense of humor, he quipped in the interview that his work on the project was likely far from over.

“None of them are going to fit,” he said. “So I figured I’d offer to alter them.”

Dr. Guy also grew grapes and made wine at a small vineyard on a mountain near San Miguel de Allende in Mexico, built a 40-foot sailboat, and tinkered with cars.

“My father could figure out how to do almost anything,” his daughter, Nancy Wheeler, said in a tribute.

Born Feb. 24, 1924, in Chester, S.C., and raised in Norfolk, Va., Dr. Guy excelled at math and science and earned a scholarship to the College of William & Mary. As a freshman, he joined an accelerated U.S. Navy program that trained undergraduates to become doctors during World War II, and he graduated just two years later.

He served stateside in the Navy during the war, and earned his medical degree from the University of Virginia. He moved to Philadelphia to work at Penn, and served stateside in the Air Force during the Korean War from 1950-53.

Dr. Guy met Gloria Rankin during college at William & Mary. They married, had four children, and lived in Bryn Mawr. After their divorce, he met interior designer Patricia Crane, and they married in 1971. They lived in Bala Cynwyd, and Fairmount, and had a house in Loveladies on Long Beach Island. She died in 2011.

Dr. Guy liked opera, crossword puzzles, word games, and charades. He memorized the work of his favorites poets, and could recite entire passages of Yeats, Thomas, and Keats. He read The Iliad and the Odyssey in his 80s.

“Despite knowing how to do almost everything, he was quite modest,” his stepson said.

In addition to his daughter, first wife, and stepson, Dr. Guy is survived by sons Edward Jr. and Thomas; daughter Susan Guy Brown; stepdaughter Susan Crane; 11 grandchildren; companion Susan Andres; and other relatives. A brother died earlier.

Private services are to be held later.