CHARLESTON, S.C. — Vice President Joe Biden worshipped and spoke at the Sunday service of the historic African-American church where nine people were gunned down during Bible study earlier this month.

The vice president’s surprise appearance came on the second Sunday the Emanuel African Methodist Episcopal Church held regular services following the June 17 shooting. Police contend the attack was racially motived and have charged a 21-year-old white man with the killings.

Biden said he’d visited Emanuel before and knew the Rev. Clementa Pinckney, the pastor of the church who was among those killed.

“We came back because my family and I wanted to show solidarity with the families and with the church,” said Biden, wearing a purple tie, a traditional color of the African Methodist Episcopal Church.

Biden, a Catholic, showed the congregation the rosary beads he wore around his wrist and spoke about the feeling of loss within his own life.

The vice president’s son Beau died late last month of brain cancer. Beau Biden narrowly avoided death as a young boy in a 1972 car crash that killed Joe Biden’s first wife and his daughter.

“The reason I came was to draw strength from all of you,” Biden said. “I wish I could say something that would ease the pain.”