We describe an algorithm for phasing protein crystal X-ray diffraction data that identifies, retrieves, refines and exploits general tertiary structural information from small fragments available in the Protein Data Bank. The algorithm successfully phased, through unspecific molecular replacement combined with density modification, all-helical, mixed alpha-beta, and all-beta protein structures. The method is available as a software implementation: Borges.