Iron meteorites are core fragments from differentiated and subsequently disrupted planetesimals. The parent bodies are usually assumed to have formed in the main asteroid belt, which is the source of most meteorites. Observational evidence, however, does not indicate that differentiated bodies or their fragments were ever common there. This view is also difficult to reconcile with the fact that the parent bodies of iron meteorites were as small as 20 km in diameter and that they formed 1-2 Myr earlier than the parent bodies of the ordinary chondrites. Here we show that the iron-meteorite parent bodies most probably formed in the terrestrial planet region. Fast accretion times there allowed small planetesimals to melt early in Solar System history by the decay of short-lived radionuclides (such as 26Al, 60Fe). The protoplanets emerging from this population not only induced collisional evolution among the remaining planetesimals but also scattered some of the survivors into the main belt, where they stayed for billions of years before escaping via a combination of collisions, Yarkovsky thermal forces, and resonances. We predict that some asteroids are main-belt interlopers (such as (4) Vesta). A select few may even be remnants of the long-lost precursor material that formed the Earth.