This tale is from Yoga Vasishtha, where Rama's mentor advises him to gain true strength unlike asuras Dama, Vyala, and Kata. In the inevitable battle between devas and asuras, the latter were winning, not just once but in every battle. Brahma offers devas this solution: he advises them to keep attacking and withdrawing. This constant on-off ruse will make the asuras believe themselves to be invincible. This will create their downfall by strengthening the I-factor. Once this I-factor becomes strong, the asuras will start suffering a steady down-fall because this sort of success also generates deep fear (of failure), a compulsive and self-destructive obsession with superficial worldly pleasures which will dissipate their energies, which will drag their mental powers further down. They will become depressed, agitated, they will destroy themselves. To have true strength, advises Vasishtha, you have to constantly nip the obsessive I-factor, focusing on the work at hand instead of the false ego. Such pure focus will ensure success, while the sort of success bred by the ego is sure to collapse. The mythical devas and asuras, of course, stand for our own positive and negative selves, while the battle success being discussed is related to any work we undertake.
According to Yoga Vashishta, three qualities can help u fight the ego which destroys, as it did the asuras above:
These qualities are strength, luster of awareness and stability or firmness.