The flatworm stem cell system is exceptional within the animal kingdom, as totipotent stem cells (neoblasts) are the only dividing cells within the organism. In contrast to most organisms, piwi-like gene expression in flatworms is extended from germ cells to somatic stem cells. We describe the isolation and characterization of the piwi homologue macpiwi in the flatworm Macrostomum lignano. We use in situ hybridization, antibody staining and RNA interference to study macpiwi expression and function in adults, during postembryonic development, regeneration and upon starvation. We found novelties regarding piwi function and observed differences to current piwi functions in flatworms. First, macpiwi was essential for the maintenance of somatic stem cells in adult animals. A knock-down of macpiwi led to a complete elimination of stem cells and death of the animals. Second, the regulation of stem cells was different in adults and regenerates compared to postembryonic development. Third, sexual reproduction of M. lignano allowed to follow germline formation during postembryonic development, regeneration, and starvation. Fourth, piwi expression in hatchlings further supports an embryonic formation of the germline in M. lignano. Our findings address new questions in flatworm stem cell research and provide a basis for comparison with higher organisms.