Midna is a member of the Twili, a fictional race of magic-wielders, who have been imprisoned in the Twilight Realm. Prior to the events of the game, Midna, the Twilight Princess, is appointed to become the Twili‘s next ruler. Her reign is cut short when Zant, a servant of the Twili's Royal Family, usurps Midna's rightful position as ruler of the Twili and transforms her into an imp. He begins to exploit his sovereignty, and corrupts many of the Twili's denizens. Midna escapes, stealing a piece of a group of ancient and powerful artifacts called the Fused Shadow, and wearing it as a helmet. She then begins seeking out the remaining three pieces of the Fused Shadow, in a bid to grant her the power to defeat Zant. Midna spies on Link's capture by Zant's Shadow Beasts and shows up in the prison to rescue him. Link, in a state of disarray after being transformed into a wolf, has no choice but to accept her help.
The two form a mutually beneficial partnership—Midna helps Link learn certain abilities and attacks, while also offering invaluable advice. In turn, Link helps Midna recover the pieces of the Fused Shadow. At first, Midna maintains a sassy and insensitive behavior towards Link,but in their adventures Midna opens up to Link, and tells him of her past. Soon the two become best friends and dedicated allies. The duo eventually battle their way through three dungeons in order to retrieve the remaining pieces of the Fused Shadow. However, Zant catches the two of them off guard after they overcome the trials of the Lakebed Temple, and seizes the Fused Shadow before Midna can use it against him. He then proceeds to expose Midna, a native of the Twilight Realm, to the light of a Hylian Light Spirit, Lanayru, and curses Link into his wolf form using a form of ancient magic that can only be broken if Link can find the Master Sword. The exposure leaves Midna near death. Link carries his dying companion to Princess Zelda, who, despite Midna's protest, uses her power to revive Midna, making her a being of light (who can now be seen in and endure the power of the "Light World," Hyrule), and disappears in the process.
During the latter portion of the game, it is revealed that Zelda's spirit was residing inside of Midna. She then leads Link on a new objective to find the Twilight Mirror, an artifact that will enable the two to enter Twilight Realm and defeat Zant. En route to finding the mirror, they discover the Master Sword, which not only changes Link back to his original form, but also leads Midna to discover how to change Link back and forth from wolf to human at will. They finally find the mirror's chamber above the fourth temple, only to discover that Zant has smashed it and scattered the pieces across Hyrule. After reassembling the mirror, a group of Sages appears and informs Link that Midna is the Twilight Princess, and the true heir to the realm. Midna and Link finally travel to the Twilight Realm, where they infuse the Master Sword with the power of the Sols (two large orbs of light) and attack Zant. After a long battle, he falls to Link's Master Sword, but refuses to surrender. Mortally injured, Zant mocks Midna to the point where, enraged, she draws upon a small fraction of Fused Shadow's power and impales Zant on her ponytail.
The two travel to Hyrule Castle, where Midna uses the Fused Shadow to transform into a large arachnid-like beast, and breaks into the castle. She then attempts to block Ganondorf's possession of Zelda, and helps Link defeat Ganon in his Beast form. When Ganon transforms into his "god" form, a massive version of his head made of flames, she transforms into her arachnid form and attacks him. She warps Link and Zelda to Hyrule Field, where they watch as the castle collapses. Ganondorf, now back in his human form, rides out of the smoke on a black horse, crushing the Fused Shadow shard Midna wore as a helmet. After Zelda helps Link battle and defeat Ganon, Link discovers that Midna survived her battle with Ganon, and was restored to her former self. During the game's final cinematic sequence, she bids farewell to Link and Zelda. While making her return to the Twilight Realm, she destroys the Twilight Mirror, thus closing the only known link between the two worlds.