(CNN) Democratic presidential candidate Joe Biden reflected on how personal tragedy has affected his faith while connecting Wednesday night with a pastor who lost his wife in the 2015 mass shooting at a church in Charleston, South Carolina.

The Rev. Anthony Thompson's wife, Myra, was one of nine African Americans killed by a white supremacist at a Bible study at the Emanuel African Methodist Episcopal Church. Thompson asked Biden at a CNN town hall in Charleston about the former vice president's faith and how it would inform his decision-making if he's elected president.

"Well, Reverend, I kind of know what it's like to lose family, and my heart goes out to you," Biden said.

"I don't know how you've dealt with it, Reverend," Biden said. "But the way I've been able to deal with when my wife was killed and my daughter was killed and then my son died, I've only been able to deal with it by realizing they're part of my being. My son Beau was my soul."

Biden's first wife and infant daughter were killed in 1972 in a car crash, right after he had won his US Senate seat. Biden's son Beau, an Iraq War veteran who served as the attorney general of Delaware, died in 2015 from brain cancer at the age of 46.

Read More