- "Who are you? How did you get past the guards?"
- — Princess Zelda
The Castle Courtyard (城の中庭 Shiro no Nakaniwa) is a location from The Legend of Zelda: Ocarina of Time. This courtyard, located inside Hyrule Castle, is filled with decorative bushes and statues of unknown figures in Hyrule's history. It is guarded by Hyrulean Soldiers day and night. At night, it is impossible to pass through the courtyard due to heavy guard schedules. The courtyard's pathway ultimately leads to the central courtyard near the Throne Room.
Interestingly, the windows in the central courtyard contain Easter eggs. First, if a Deku Seed is shot through the window on the left, a Hyrulean Soldier will appear in the window and tell Link not to cause trouble, throwing a bomb at the hero as he disappears. Second, the window on the right side contains a room full of portraits of Mario series characters: Mario, Luigi, Bowser, Princess Peach and Yoshi. In the 3DS remake, a classic Super Mario Bros. level is seen through this window. Also, a Deku Seed can be shot at this window to make a Red Rupee appear.
At the behest of the dead Great Deku Tree, Link plans to sneak into Hyrule Castle to meet with Princess Zelda. Link manages to sneak past the soldiers patrolling the Castle Grounds by hiding behind bushes and statues staying out of the soldiers' line of sight, and finds a small drain on the eastern side of the castle, which he uses to access the courtyard, where Link eventually meets Princess Zelda. She tells him that she had a prophetic dream in which a dark power would rise from the desert in the west; from the forest in the south would come a green light holding green stone to thwart the evil. She believes this to be Link, and the evil power to be Ganondorf, a strange mystic who is swearing allegiance to the King of Hyrule as they speak.
She tells him about the Sacred Realm inside the Temple of Time. She believes that Ganondorf's plan is to enter that forbidden realm and take the Triforce to do his evil bidding. She tells Link that the only way to stop him is to enter the realm before Ganondorf and make a wish upon the Triforce that Ganondorf's evil plans fail. Link is told that he needs all three Spiritual Stones and the Royal Family's treasure, the Ocarina of Time, to open the gate to the Sacred Realm. She sends Link on this quest, but before he leaves the castle, Zelda's attendant, Impa, teaches him "Zelda's Lullaby".
Princess Zelda's plans ultimately fail however, and Ganondorf obtains the Triforce when Link and Navi are sent into a seven year slumber. Ganondorf then goes on to wreak havoc and usurp control of Hyrule. When Link finally awakens, he sets out to stop Ganondorf and successfully defeats the King of Evil at his castle. When this happens, Zelda thanks the hero and sends him back in time to regain his childhood. Using the Ocarina of Time, she succeeds in doing so and Link finds himself in the Temple of Time as a youth. Knowing of the events about to unfold, however, Link goes to Princess Zelda in the Castle Courtyard and warns her about Ganondorf's pending attack on Hyrule. With this, the game comes to a close, but these events unfold into what would later become the backstory for The Legend of Zelda: Twilight Princess.