In somber remarks, President Obama said visiting a slave trading outpost in Ghana brought him both sadness and hope.

Obama remarks came after a tour of the Cape Coast Castle, which sits on Ghana's coastline with the Atlantic Ocean. The castle is almost 500 years old and served as a slave trading outpost for European nations.

The first African American president said he felt two emotions as he took the tour.

"As African Americans, there is a special sense that on the one hand, this place was a place of profound sadness," Obama said.

The president went on to say that the prison also represents where the African American experience began and a "celebration with the people of Ghana of the extraordinary progress we've abolish slavery and to ultimately win civil rights for all people."

"It is a source of hope," Obama said. "It reminds us that as bad as history can be, it is also possible to overcome."

Obama also drew a parallel between the prison and Buchenald, the Nazi concentration camp he visited in early June, because "it reminds of us of the capacity of human beings to commit great evil."

Obama spoke of the African American diaspora and the "portal" through which slaves were shipped around the globe.

In the tour, Obama saw the dark dungeons in the castle where men and woman slaves were held. When slaves were purchased, they were processed and passed through a "door of no return" when they boarded slave ships.

Obama said it was an "extraordinary tour" and, in particular, noted that right above the dungeon where male captives were held was a church.

"That reminds us that sometimes we can tolerate and stand by great evil even as we think we are doing good," Obama said.

Obama was joined by his wife and daughters on the tour and said he felt it was important for his daughters to see that "history can take very cruel turns."

The president also said that the castle was another reminder that the U.S. will fight civil rights abuses.

The castle "teach[es] all of us that we have to do all we can to fight against the kinds of evils that still exist in our world," he said. "Any group of people who are degrading another group of people have to be fought against with whatever tools we have available to us."