Tulsidas, Shri Krishna and the Gurus on Avatars

Whenever it is needed, the lord comes in different avtaars. 

An avatar (Sanskrit: अवतार, IAST: avatāra; Sanskrit pronunciation: [ɐʋɐtaːrɐ]), a concept in Hinduism that means "descent", is the material appearance or incarnation of a deity on earth. The relative verb to "alight, to make one's appearance" is sometimes used to refer to any guru or revered human being. Incarnation concepts that are in some aspects similar to avatar are also found in Buddhism, Christianity, and other religions.

Tulsidas in Ramayan

जब जब होई धरम की हानि, 
बारहि असुर अधम अभिमानी।
तब तक धर प्रभू विविध शरीरा, 
हरहि दयानिधि सच्जन पीड़ा।

jab jab hoi dharam ki hani 
badhahi asur adham abhimani 
tab tab prabhu dharhi vividh sharira 
harhi kripanidhi sajjan pira. 

Whenever religion declines and people with demonic tendencies tend to grow, then the Lord comes in different human forms to remove the pains of good people.

Guru Gobind Singh, Bachitra Natak Chapter 6:

Now I relate my own story as to how I was brought here, while I was absorbed in deep meditation.The site was the mountain named Hemkunt, with seven peaks and looks there very impressive..That mountain is called Sapt Shring (seven-peaked mountain), where the Pandavas practised Yoga.There I was absorbed in deep meditation on the Primal Power, the Supreme KAL.In this way, my meditation reached its zenith and I became One with the Omnipotent Lord….

When the Lord ordered me, I was born in this Kaliyuga (Dark Age).I had no desire to come, because I was totally absorbed in devotion for the Holy feet of the Lord.When then God made me understand (His Will), God spoke these words and sent me in the world:” “When I first created the Universe, I created the ignominious and dreadful Daityas. Who became mad with power and abandoned the worship of Supreme Purusha. I destroyed them in no time and created gods in their place. They were also absorbed in the worship of power and called themselves Omnipotent. (Then I created) Mahadevs, Those who were fixed and ones who mastered air (Siddhas), (but) they could not reach the Param Purkh – Supreme Being, the Lord.

On whomsoever wisdom dawned, he started his own path.  None could realize the Supreme Lord, but instead spread strife, enmity and ego. The tree and the leaves began to burn, because of the inner fire. None followed the path of the Lord. Whosoever attained a little spiritual power (siddhi), he started his own path. None could comprehend the Lord, but instead became mad with ‘I-ness’. Nobody recognized the Supreme Essence, but was entangled within themselves. All the great rishis (sages), who were then created, produced their own Smritis. All those who became followers of these Smritis, they abandoned God. Those who devoted themselves to the Feet of the Lord, they did not adopt the path of the Smritis…..Everyone placed his own interest first and foremost and did not comprehend the Supreme Brahman.

To do this work the Lord sent me and then I was born into this world.As it was spoken to me, I am repeating the same (unto you), I do not have enmity with anyone.Whosoever shall call me the Lord, shall fall into hell.Consider me as His servant and do not think of any difference between me and the Lord.I am the servant of the Supreme Purusha and hath come to see the Sport of the world.Whatever the Lord of the world said, I say the same unto you, I cannot remain silent in this abode of death.

- Bachitar Natak (Wonderful Drama), Chapter 6

Shri Krishna in Bhagwad Gita

यदा यदा हि धर्मस्य ग्लानिर्भवति भारत ।
अभ्युत्थानमधर्मस्य तदात्मानं सृजाम्यहम् ॥४-७॥

परित्राणाय साधूनां विनाशाय च दुष्कृताम् ।
धर्मसंस्थापनार्थाय सम्भवामि युगे युगे ॥४-८॥

Yada yada hi dharmasya glanirbhavati bharata
Abhythanamadharmasya tadatmanam srijamyaham

Paritranaya sadhunang vinashay cha dushkritam
Dharmasangsthapanarthay sambhabami yuge yuge

Whenever there is decay of righteousness, O Bharata,
And there is exaltation of unrighteousness, then I Myself come forth ;

For the protection of the good, for the destruction of evil-doers,
For the sake of firmly establishing righteousness, I am born from age to age.

Swami Vivekananda's translation, "Whenever virtue subsides and wickedness prevails, I manifest Myself. To establish virtue, to destroy evil, to save the good I come from Yuga (age) to Yuga."