The B–class of MADS box genes has been studied in a wide range of plant species, but has remained largely uncharacterized in legumes. Here we investigate the evolutionary fate of the duplicated AP3-like genes of a legume species. To obtain insight into the extent to which B-class MADS box gene functions are conserved or have diversified in legumes, we isolated and characterized the two members of the AP3 lineage in Medicago truncatula: MtNMH7 and MtTM6 (euAP3 and paleoAP3 genes, respectively). A non-overlapping and complementary expression pattern of both genes was observed in petals and stamens. MtTM6 was expressed predominantly in the outer cell layers of both floral organs, and MtNMH7 in the inner cell layers of petals and stamens. Functional analyses by reverse genetics approaches (RNAi and Tnt1 mutagenesis) showed that the contribution of MtNMH7 to petal identity is more important than that of MtTM6, whereas MtTM6 plays a more important role in stamen identity than its paralog MtNMH7. Our results suggest that the M. truncatula AP3-like genes have undergone a functional specialization process associated with complete partitioning of gene expression patterns of the ancestral gene lineage. We provide information regarding the similarities and differences in petal and stamen development among core eudicots.