Nucleation of ice by airborne particles is a process vital to weather and climate, yet our understanding of the mechanisms underlying this process is limited. Kaolinite is a clay that is a significant component of airborne particles and is an effective ice nucleus. Despite receiving considerable attention, the microscopic mechanism(s) by which kaolinite nucleates ice is not known. We report molecular dynamics simulations of heterogeneous ice nucleation by kaolinite (001) surfaces. Both the Al-surface and the Si-surface nucleate ice. For the Al-surface, reorientation of the surface hydroxyl groups is essential for ice nucleation. This flexibility allows the Al-surface to adopt a structure which is compatible with hexagonal ice, Ih, at the atomic level. On the rigid Si-surface, ice nucleates via an unusual structure that consists of an ordered arrangement of hexagonal and cubic ice layers, joined at their basal planes where the interfacial energy cost is low. This ice structure provides a good match to the atomistic structure of the Si-surface. This example is important and may have far-reaching implications because it demonstrates that potential ice nuclei need not be good atomic-level matches to particular planes of ice Ih or cubic ice, Ic. It suggests that surfaces can act as effective ice nuclei by matching one of the much larger set of planes that can be constructed by regular arrangements of hexagonal and cubic ice.