Bhagavad Gita 4.7
Chapter 4: Knowledge and the offering of action
यदा यदा हि धर्मस्य ग्लानिर्भवति भारत ।
अभ्युत्थानमधर्मस्य तदाऽऽत्मानं सृजाम्यहम् ॥ ७ ॥
Whenever there is decay of righteousness, O Bhârata, and there is exaltation of unrighteousness, then I Myself come forth;
Sanskrit text and English translation: Annie Besant, The Bhagavad-Gita, 4th edition (1922) — public domain, via Wikisource. Chapter summaries: SamayaVeda.