President Barack Obama delivered a eulogy during the funeral of Rev. Clementa Pinckney, one of the slain pastors in the Charleston church shooting last week, and moved the crowd as he sang "Amazing Grace."

The president gave a 38-minute eulogy where he cited the history of the Emanel church. "We do not know whether the killer of Rev. Pinckney and eight others knew all of this history. But he surely sensed the meaning of his violent act," he said. "It was an act that drew on a long history of bombs and arsons and shots fired at churches; not random, but as a means of control, a way to terrorize and oppress."

Obama celebrated the lives of the fallen and denounced the Confederate battle flag as "a reminder of systemic oppression and racial subjugation" from slavery through opposition to the civil rights movement, according to Yahoo! Politics.

The president also warned against staying blind to "the unique mayhem that gun violence inflicts upon this nation."

He also spoke about taking down the Confederate flag as a righteous step, saying it would be "a meaningful balm for so many unhealed wounds," The New York Times reported.

The crowd was taken aback when Obama wrapped up the funeral in a song, as he belted the first words of "Amazing Grace" all by himself. The ministers, the choir and the audience stood up and sang with him.

The White House's official Twitter account shared a video of the president's singing that touched many people and had gone viral.