I recently finished “Just Mercy: A Story of Justice and Redemption,’’ Bryan Stevenson’s extraordinary memoir.

The chapter Stevenson calls “Mitigation’’ feels like the most important passage I have ever read anywhere.

Stevenson, a lawyer who works to free the unjustly convicted or egregiously sentenced and to end the death penalty, starts the chapter with this assertion: “America’s prisons have become warehouses for the mentally ill.’’

He goes on to introduce Avery Jenkins, imprisoned for the murder of a man who was stabbed multiple times, as if his attacker were in a frenzy of fear.

In prison Avery often experienced psychotic episodes in which he would scream for hours. His father had been murdered before he was born and his mother died of a drug overdose when he was one. He entered foster care. No one would put up for long with a child with cognitive impairments that suggested brain damage and behavioral problems that suggested schizophrenia. He lived in 19 foster homes. One woman—and she was not the only one who was abusive—once took him out to the woods and tied him to a tree, where hunters found him three days later.

Avery was having a psychotic episode when, at 20 and by then homeless for several years, he wandered into a strange house. He stabbed a man he found there who he thought was a demon.

Avery’s defense team did not investigate his past. He was convicted of murder and sentenced to death.

Stevenson took on Avery’s case years later. On his first visit to see Avery as a client, Stevenson saw a truck in the prison parking lot that was covered with Confederate flag decals and racist bumper stickers. That day inside the prison, which he had visited numerous times to see other clients, Stevenson met a new guard. The guard, who was white, subjected Stevenson, who is black, to a strip search and other indignities lawyers were usually spared. Finally, as the guard ushered Stevenson into the visiting room, he asked whether the lawyer had seen the bumper stickered truck: “I want you to know, that’s my truck.’’

During that first interview with Avery, the most coherent thing Stevenson could get from him was a request for a chocolate milkshake. Regretfully, Stevenson had to tell him he couldn’t smuggle treats into prison.

Months and many more strip searches and milkshake-less visits later, Stevenson was able to schedule a court hearing at which he presented evidence of Avery’s mental health history and current disability.

Avery, who is black, was brought to court for the three-day hearing by the guard who had harassed Stevenson. After the hearing, Stevenson made a point of visiting Avery at prison as soon as possible, not least because of concern about how Avery had been treated during the three-hour drive from prison to courthouse. Imagine the lawyer’s surprise when the guard greeted him cordially. I’ll let the guard, as quoted by Stevenson, take up the tale:

“You know, I—uh, well, I appreciate what you’re doing. I really do. It was kind of difficult for me to be in that courtroom to hear what y’all was talking about. I came up in foster care, you know. I came up in foster care, too.’’ His face softened. “Man, I didn’t think anybody had it as bad as me. They moved me around like I wasn’t wanted nowhere. I had it pretty rough. But listening to what you was saying about Avery made me realize that there were other people who had it as bad as I did. I guess even worse. I mean, it brought back a lot of memories, sitting in that courtroom."

He reached into his pocket to pull out a handkerchief to wipe the perspiration that had formed on his brow. I noticed for the first time that he had a Confederate flag tattooed on his arm.

“You know, I guess what I’m trying to say is that I think it’s good what you’re doing. I got so angry coming up that there were plenty of times when I really wanted to hurt somebody, just because I was angry. I made it to eighteen, joined the military, and you know, I’ve been okay. But sitting in that courtroom brought back memories, and I think I realized how I’m still kind of angry.

I smiled. He continued. “That expert doctor you put up said some of the damage that’s done to kids in these abusive homes is permanent; that kind of made me worry. You think that’s true?"

“Oh, I think we can always do better," I told him. “The bad things that happen to us don’t define us. It’s just important sometimes that people understand where we’re coming from."

We were both speaking softly to one another. Another officer walked by and stared at us. I went on: “You know, I really appreciate you saying to me what you just said. It means a lot, I really mean that. Sometimes I forget how we all need mitigation at some point."

He looked at me and smiled. “You kept talking about mitigation in that court. I said to myself, “What the hell is wrong with him? Why does he keep talking about “mitigation’’ like that? When I got home I looked it up. I wasn’t sure what you meant at first, but now I do."

I laughed. “Sometimes I get going in court, and I’m not sure I know what I’m saying, either."

“Well, I think you done good, real good." He looked me in the eye before he extended his hand. We shook hands and I started toward the door again. I was just about inside when he grabbed my arm again.

“Oh, wait. I’ve got to tell you something else. Listen, I did something I probably wasn’t supposed to do, but I want you to know about it. On the way back down here, after court on that last day—well, I know how Avery is, you know. Well anyway, I just want you to know that I took an exit off the interstate on the way back. And, well, I took him to a Wendy’s, and I bought him a chocolate milkshake.’’

Stevenson eventually won a new trial for Avery and got him off death row and into a facility with mental health services. Stevenson never again saw the guard, but heard he had quit the prison service.

I never thought the mention of a Wendy’s milkshake could make me tear up.