CHARLESTON, S.C. — In an interview last year with F.B.I. agents, Dylann S. Roof admitted to opening fire at a prominent black church here “because somebody had to do something” about crime by African-Americans, and he appeared stunned to learn that his rampage had left nine people dead.

“I went to that church in Charleston, and, you know, I did it,” Mr. Roof told two F.B.I. officials in an interview that was videotaped in June 2015 and viewed by jurors on Friday, the third day of his federal death penalty trial.

Mr. Roof’s defense lawyers have long acknowledged his guilt in the killings at the Emanuel African Methodist Episcopal Church — the Justice Department rejected an offer for him to plead guilty in exchange for a sentence of life in prison — but Friday marked the first time that jurors were able to hear Mr. Roof elaborate on the massacre and his motives.

“What I did is so minuscule to…