CHARLESTON, S.C. — Polly Sheppard, a 72-year-old retired nurse and longtime stalwart of Emanuel African Methodist Episcopal Church, dived under a table as the gunfire began and did the only thing she could think to do: She prayed aloud. She could see the bullet casings skittering across the floor of the fellowship hall and the young man’s boots approaching. Dylann S. Roof told her to “shut up,” then asked menacingly if he had shot her yet.

“I said ‘no,’” Ms. Sheppard testified on Wednesday, as the final witness in the guilt phase of Mr. Roof’s federal trial on 33 counts, including hate crimes resulting in death. “And he said, ‘I’m not going to. I’m going to leave you to tell the story.’”

She did, in a panicked call to a 911 operator that night, and again on Wednesday, when she described the events to a courtroom crowded with family members of the nine parishioners Mr. Roof is accused of killing in a massacre on June 17, 2015.

After Ms. Sheppard finished testifying, the prosecution rested, and Mr. Roof’s defense lawyers followed suit after declining to call any witnesses. With their eyes on the sentencing phase of the death penalty trial, the lawyers have tried to make suggestions of Mr. Roof’s mental incapacity, but have been allowed little leeway by Judge Richard M. Gergel.