Lord Shiva was very powerful but at same time innocent too for his devotees. Lord Shiva never differentiated between his devotees, whether they were Devas or Asuras. Once a demon (asura) named Bhasmasura did a great menace towards Lord Shiva.
Boon to Bhasmasura:
As per Indian mythology, Bhasmasura was very strong and big in size but he used to act before thinking. He wanted to become most powerful Asura in their community. He knew, Lord Shiva can be easily satisfied and can give any boom of his choice so he decided to perform severe penance to win the favour of Lord Shiva for become powerful. Every day, during his prayers, he used to cut a part of his body and offer it to Lord Shiva to please him. He did so for many days. Ocean of sympathy as Lord Shiva was, Lord Shiva was pleased with him and came forward to grant him whatever boon he wished for. He wanted to be immortal so he said, "Lord, please grant me the wish that whichever person, place or thing I place my right hand on, is reduced to ashes". Lord Shiva granted him the boon and Bhasmasura was very happy.
Attack on Lord Shiva:
Bhasmasura, being the wicked demon as he was, wanted to try his boon on Lord Shiva himself and tried to touch His head. A panicked Lord Shiva had to run away from Bhasmasura and approached Lord Vishnu to help him.
Lord Vishnu Avatar(Mohini):
Lord Vishnu changed himself into a beautiful young maiden, called Mohini. Bhasmasura stopped as he had not seen this much beautiful girl. She was so beautiful and so graceful that for a minute Bhasmasura even forgot who he was. She talked in a way that she caught him in her beauty. He felt in love to Mohini and asked her to marry him.
Mohini continued, 'I am a dancer Bhasmasura. When I was younger I made a promise that I would only marry a man who can dance as good as mine. Bhasmasura blinked as he didn’t know any moves but he promised to learn for his love.
Mohini started teaching different-2 acts to him. He was giving his full concentration to dance only. After some time, Bhasmasura got better and better at copying Mohini's moves. Mohini soon had a move where she kept her hand on her head. Without thinking Bhasmasura did the same!
Lord Shiva boon worked and he was burned into a pile of bhasma (ashes). Mohini was looking at Bhasmasura's ashes as Lord Shiva appeared before Mohini. Lord Shiva went back to Kailash, thanking Lord Vishnu.