Agahnim

When Hyrule became besieged by an onslaught of terrible misfortunes (pestilence, drought, etc.), the King of Hyrule offered a reward to anyone who could put an end to these disasters. A mysterious stranger named Agahnim (アグニム, Agunimu) came and put an end to these troubles with a previously unknown magic. He was declared a hero and given the prestigious positions of chief adviser to the King and heir to the Seven Wise Men. Agahnim used this position and his mysterious magic to brainwash all of Hyrule's soldiers, dispose of the King of Hyrule, and make six of the descendants of the Seven Wise Men disappear to the Dark World.

After being rescued by Link, Zelda, the last of the descendants, hides in the Sanctuary until Agahnim's troops find her and take her to the tower at the top of Hyrule Castle. There, Agahnim sends her to the Dark World, thus breaking the Seal of the Seven Wise Men. Before Link can soundly defeat him, Agahnim draws him into the Dark World. During his quest to rescue the Seven Maidens, Link learns that Agahnim is a servant, or perhaps a pawn, of Ganon.

When Link defeats Agahnim at the top of Ganon's Tower in the Dark World, this time for real, Agahnim collapses and from his body a faint image of Ganon appears. The image turns into a bat and flees to the Pyramid of Power.

Agahnim's relationship with Ganondorf is occasionally debated. While some believe that Agahnim was just a wizard who Ganondorf corrupted and used to do his work in the Light World (Hyrule), many others maintain that Agahnim was merely a disguise used by Ganon. This theory is strongly supported by the fact that Ganon appears from within Agahnim's body, and that in the final battle Ganon refers to Agahnim as his "alter-ego". Another theory is that his spells are based on the elements of fire, ice, and lightning. The lightning spell is the only one surely true, but the 'fireball' (single red ball) and 'ice shards' (six blue balls) are possibilities. The 'fireball' is also backed up by the fact that Agahnim flashes red when hit, and that in the second battle his hood appears to have red mixed into it, to represent burns.

Strategy
When attacking, Agahnim hurls magical attacks against Link. The first of them, a magic ball, can be hit with the Master Sword to reflect it, so that it hits Agahnim himself and wounds him. The second one can also be hit with the sword, but it splits up and flings fireballs throughout the room. The third one is a lightning attack which Link can only avoid by standing at Agahnim's side. If Link strikes at Agahnim's body with the Master Sword, he will receive a violent electrical shock.

While he fights alone in Hyrule Castle, in Ganon's Tower he creates clones of himself to irritate Link. This can work to Link's advantage, since the clones only produce magic balls that can be bounced back with the sword.

Agahnim also made a small cameo appearance in Link's Awakening, appearing as one of the forms of the final Nightmare in the Wind Fish's Egg. Here he can be defeated the same way as in the previous game, with the reflections of the magic balls.

In Oracle of Seasons he appears in 4th Dungeon, Dancing Dragon Dungeon as a Mini-Boss. He splits himself in three parts, and you have to guess which one is real (you can tell that easy because the real Agahnim has a shadow, the other two don't). You can simply hurt him by slashing him with Wooden Sword.

Trivia

 * The eye symbol that Agahnim has on the front of his robes in the official artwork, as well as a design throughout Hyrule Castle when on the way to confront him, strongly resembles the symbol of the Sheikah.
 * The Blue Stalfos mini-boss of Ancient Tomb attacks in a quite similar manner to Agahnim, except that he cannot create lightning, but instead turns Link into a baby.
 * It is possible that Agahnim is a Zuna, but nothing is known for sure.
 * Strangely enough, Agahnim's fireballs can be reflected back at him by hitting them with the Bug Catching Net. This is referenced in later games by the fact that the player can reflect Ganon's attacks by swinging an Empty Bottle.