Like other inmates interviewed, she did not want to disclose the crime that landed her in prison.

The inmates offered up insights as deep and eloquently expressed as those from the Union graduate students. Emma Cornelius, 33, of Brooklyn, an inmate who expects to be released in a year, discussed the role of women in African religions. “In terms of gender,” she observed, “there’s still this conformity with a patriarchal society, and there aren’t many women at the forefront of the religions we dealt with.”

The class fostered a closeness that took some of the Union students by surprise. Michele Stanback, 34, had to compose herself when asked how it felt to take a course with inmates. “I have a lot of emotions about it,” she said. “The way the class is set up is very intimate. It’s one of the few classes I’ve had at Union where we became a real unit, and that’s very rare in academia. We experience real joy with them. And we have inside jokes.”

But there were limits imposed by the state’s Department of Corrections and Community Supervision.

The Union students, for example, were asked not to search for information about the inmates online because the inmates cannot reciprocate, given their lack of internet access. At the final class meeting on Tuesday, a prison official reprimanded an inmate and a Union student — who had sat next to each other for nearly four months — for embracing at the end. (Physical contact is prohibited.)

Still, the instructor, Samuel Cruz, an assistant professor of church and society at Union, chose to share a personal story at the start of their last class. He explained how one of his 10 siblings — a brother — had been imprisoned in New York for 10 years. His brother died at age 36, two years after being released. “It’s been a blessing for me to have taught this course this semester,” he said. “It’s in Joel’s memory.”

There were reminders during the semester that for the inmates, the setting was in fact a lockup, not a college campus. During one class in early December, a guard interrupted the discussion and pointed at one inmate, ordering her to leave the room for a search.

“It was stressful to watch people I care about be treated in degrading and dehumanizing ways,” said Hannah Gallo, a Union student who served as Professor Cruz’s teaching assistant. “Not only was it disruptive, but it was embarrassing for her to be so viscerally reminded that she is under someone’s thumb. That was jarring.”