ATTICA, N.Y. — The singers arrived through a sally port that opened to let them through concrete walls more than three stories high. The audience members were led to their seats not by ushers but by guards with wooden batons hanging from their belts. Then the unlikely sounds of opera rang out in Attica, the maximum-security prison here in western New York that still bears the scars of the deadly 1971 uprising.

For the third summer in a row, artists from the Glimmerglass Festival had left their bucolic home in Cooperstown, N.Y., on Tuesday morning, driving three and a half hours across the state to perform for inmates and guards in an auditorium that doubles as a chapel and a steel-tabled mess hall.

“I never cried at Attica until the day I sat in its chapel and heard the glorious voices of your opera company,” one inmate wrote in a thank-you letter to Francesca Zambello, the general director of Glimmerglass, after last summer’s performance of excerpts from Puccini’s “La Bohème.” Another wrote that the music had “penetrated some of the most guarded parts of the prisoners.”

Michael Rhynes, 57, who has been incarcerated since 1984 and is working with other inmates to start a theater group at Attica, said in an interview inside the prison on Tuesday that he had been amazed by “Bohème,” his first opera, which was sung in Italian.

Jailhouse performance may be most closely associated in the popular imagination with the live-in-prison country recordings of Johnny Cash, but the classical music world has increasingly reached out to audiences behind bars. For nine years, Carnegie Hall officials have traveled up the river to work with inmates at Sing Sing Correctional Facility in Ossining, N.Y., taking the star mezzo-soprano Joyce DiDonato more than once. Riccardo Muti, the music director of the Chicago Symphony Orchestra, regularly leads performances for incarcerated youth. Even the fictional classical scene has taken note: The Amazon series “Mozart in the Jungle” filmed an episode about a concert on Rikers Island.

But performing opera at Attica poses special challenges. The prison, a huge facility that houses 2,054 inmates, is still notorious for the 1971 uprising and hostage-taking in which 43 men were killed, most after the state moved to retake the prison. In 2015, the year Glimmerglass began performing there, with the bass-baritone Eric Owens singing Verdi’s “Macbeth,” three guards pleaded guilty to a misdemeanor charge in connection with the severe beating of an inmate as part of a deal that spared them jail time in exchange for quitting their jobs. Some advocates have recommended closing the prison. Earlier this year, Attica was placed on lockdown after an outbreak of violence among inmates.

Ms. Zambello said in an interview that she was grateful to the prison officials who had given Glimmerglass’s project the green light. She added that she saw the festival’s work in Attica — at a moment when questions of crime, punishment, mass incarceration and the treatment of prisoners are being hotly debated — as part of the company’s broader outreach efforts.

“I think art is for everyone,” said Ms. Zambello, a stage director who also serves as the artistic director of Washington National Opera. “We’re here to be a bridge to groups that may not have access to the arts. I think that’s part of our job.”

This year Glimmerglass performed its first English-language opera in Attica, singing highlights from Gershwin’s “Porgy and Bess” accompanied by a pianist, but without costumes, which are hard to bring into a maximum-security prison. (When they did “La Bohème” in costume last year, they had to list everything they brought — down to the last bobby pin.) They did get permission to bring in a crutch for Musa Ngqungwana, the South African bass-baritone playing Porgy, whose disability is key to the plot.

Ms. Zambello described to the audience the opera’s story, recounting the twists and turns of a work about love, loss, race, murder, drug use, imprisonment, perseverance and hope. When she set the scene for one aria by saying that “a crap game starts,” a murmur of recognition rippled through the audience. When she said that Crown, the opera’s villain, “murders someone impulsively,” an inmate exclaimed: “Oh, man!”

The audience — roughly 180 inmates under the watchful eyes of guards — was more attentive than some paying opera audiences. Many sat forward on the wooden seats. They warmly cheered each number, beginning with “Summertime,” sung by the soprano Meroë Khalia Adeeb, and continuing through the love duets between Mr. Ngqungwana’s Porgy and the Bess of Talise Trevigne and several scene-stealing pieces by the baritone Norman Garrett. Inmates and guards gave a standing ovation when the performance ended, and one inmate cried out: “Bravo! Encore!”

When it was over, the performers, visibly moved, piled into blue corrections department vans that took them out, after a thorough inspection that included the undercarriage of each van. They returned to the prison parking lot as dozens of guards came off their shifts, many carrying the see-through clear plastic lunch bags they are required to use.

“I need to decompress,” Mr. Garrett said. Ms. Trevigne observed softly: “We get to leave.” Then the cast boarded the bus for the trip back to Cooperstown.

Ms. Zambello stayed behind to lead an evening class for the fledgling inmates’ theater group, which is being called Third Prison from the Sun. She has been corresponding with its founders for much of the year, sending them scripts of several plays that don’t have big parts for women, including “Twelve Angry Men.”

In a classroom overlooking several white ranch houses with outdoor play sets, where some Attica inmates are allowed 48-hour visits with their families, she walked the group through the basics of putting on plays. “Everyone can tell a story,” she told them. “You can do it anywhere. You can definitely do it here.”

William Oree, one of the inmate founders, asked her about casting, how to project, when to try to use an accent and how to avoid potential conflicts among the cast.

Mr. Rhynes, who helped found the Phoenix Players Theater Group while at Auburn Correctional Facility about 100 miles east of Attica, said he hoped theater could give the men new experiences, as well as change perceptions about prisoners. “Theater gives us a chance to transform, to become something different,” he said. “And believe me, it works.”

Ms. Zambello hopes to expand the partnership for next year’s offering, the musical “West Side Story,” which Glimmerglass is performing as part of Leonard Bernstein’s centennial: She wants to teach the inmates the choruses, so they can participate.

It sounded good to Mr. Rhynes. “I’ve always wanted to be a Jet,” he said.