Vice President Joe Biden, center, with son and daughter-in-law Hunter and Kathleen Biden, to his right, sing “We Shall Overcome” while joining hands with Emanuel AME Church members Sunday, June 28, 2015 in Charleston, S.C. (Melissa Boughton/AP)

Vice President Biden paid a surprise visit to Sunday morning services at Emanuel AME Church here, telling congregants that he came to support them and to help get through his own mourning.

“My family and I wanted to show our solidarity,” Biden said during five minutes of remarks.

Standing next to one of the church’s pastors, he said: “But to be selfish about it, reverend, the reason we came was to draw some strength from all of you, to draw some strength from the church.”

His remarks echoed a sentiment shared throughout the country by those who have been moved by how Emanuel AME members have reacted to tragedy. On June 17, nine people were fatally shot during a Bible study at the church, and police have charged a 21-year-old avowed white supremacist with the killings.

The vice president arrived with his son Hunter and his daughter-in-law Kathleen. He spoke about his anguish since the death of his son Beau from brain cancer last month. Biden said he wished there was something he could say to ease the pain of the families of the nine victims.

“But I know from experience, and I was reminded of it again 29 days ago, that no words can mend a broken heart. No music can fill the gaping void,” Biden said. “At least in my experience, only faith, only faith, and sometimes — as all the preachers in here know — sometimes even faith leaves you, just for a second, sometimes you doubt.”

He talked about how he prays the rosary and wears rosary beads around his wrist to help him through such moments.

“There’s a famous expression that says, ‘Faith sees best in the dark,’ ” Biden said. “And for the nine families, this is a very dark, dark time.”

Biden’s appearance caught members by surprise, and church leaders asked him to speak.

“I pray that the families will find refuge in the shadow of His wings,” Biden said, his voice halting. “And I pray that the love that all of you have shown to them, and to people around the country and to me, will help mend the broken hearts of their families and mine. May God love you all, thank you.”

As he closed he read from Psalms 36:5-7.

Biden’s words drew a 35-second ovation as he took his seat in a third-row pew next to his son and daughter-in-law, and they fell into the rhythms of the service.

The Rev. Norvel Goff joked that if he saw people were not paying attention, he was apt to speak for a long time — from “Genesis, and I will end with Revelations.” Biden laughed, along with others.

In a rousing hymn, church members stood, held hands and sang “We Shall Overcome.” Biden and his family joined them.

Toward the end of the service, Charleston’s longtime mayor, Joseph Riley, took a seat next to Biden. The two spoke for several minutes. They walked out the front of the church, allowing Biden to see the flowers and tributes people continue to leave on the sidewalk. Then they walked around to the side of the church and entered a door leading to the basement for a visit there. Minutes later, Biden came out, said his goodbyes, and left in his motorcade.

In an interview afterward, Riley related what he and Biden had spoken about.

“He just talked about the wonderful example this community has given the world about how to respond to tragedy with peace and unity,” Riley said.

The vice president told him he’d received a call recently from the leader of a country racked with strife who was amazed that the killings in Charleston had prompted such a calm response. Riley said that the leader had essentially asked Biden: “How does this happen in America? How does this happen in this community? Where is the violence?”

Biden had traveled to Charleston for the funeral Friday of Emanuel’s senior pastor, the Rev. Clementa Pinckney. But that service was held at an arena to accommodate the large crowd. Biden knew Emanuel AME from previous visits and said he wanted to return. In the basement of the church, Riley took Biden into Pinckney’s office to show him a photograph that he kept there — of Pinckney and Biden.

“His heart was warmed,” Riley said. “I think he was very proud to see it.”

Sunday afternoon, members of Emanuel AME gathered for another funeral, this one for the Rev. DePayne Middleton-Doctor, one of the nine victims.