The first tracking of the dynamics of a natural invasion by a transposable element (TE) provides unprecedented details on the establishment of host defense mechanisms against TEs. We captured a D. simulans population at an early stage of a P-element invasion and studied the spread of the TE in replicated experimentally evolving populations kept under hot and cold conditions. We analyzed the factors controlling the invasion by NGS, RNA-FISH, and gonadal dysgenesis assays. Under hot conditions, the P-element spread rapidly for 20 generations, but no further spread was noted later on. This plateauing of the invasion was mediated by the rapid emergence of P-element-specific piRNAs. Under cold conditions, we observed a lower expression of the P-element and a slower emergence of the piRNA defense, resulting in a three times slower invasion that continued beyond 40 generations. We conclude that the environment is a major factor determining the evolution of TEs in their host.