even the walls of the incan temple had been plated with inch-thick slabs of gold-until the spanish had ransacked and stripped it , tearing the structure down to the foundations to build their god 's church atop it .