The story begins with three soldiers; a Scotsman, an Englishman and an Irishman. They resolve to leave the army, and sneak away as soon as possible. They wander the woods for days, sleeping in trees at night to avoid the wild beasts that stalk the woods. One morning, the Scotsman awakens in a tree and spies a castle in the distance. Tired and hungry, he sets off for the castle without telling the others where he is going. He arrives at the castle, but it is locked and no fire is coming from the chimney. He is about to leave when a beautiful woman calls out to him from a window, and promises him the food and rest he seeks. He enters the castle, eats his fill and falls asleep in a large room filled with other sleeping men.
The Englishman and Irishman are unsure of what has happened to the Scotsman. The Englishman, by chance, climbs the same tree the Scotsman climbed previously, and sees the same castle in the distance. Ravished with hunger, he too treks towards the castle without a word to the Irishman, and receives exactly the same treatment at the castle as the Scotsman who went before him.
The Irishman wakes in the morning to discover that he is alone. He decides that at this point there is little point in trying to continue through the woods and resigns himself to his fate. By chance he spends the night in the same tree as the other two men, having not moved camp since the Scotsman went missing. He spies the castle, and decides that he may find food and shelter within, and immediately sets off to find the castle. He arrives in the castle and the woman greets him as well, and sets a great feast before him. Yet he refuses to eat or drink or take rest until the woman explains who she is and what is going on. The woman consents and explains that she is a cursed princess who cannot leave the castle, and her father, the king, promises a third of his kingdom while living, and the rest upon his death, and the hand of the princess in marriage to the man who can break the curse. The princess tells the Irishman that of all the men who have come to the castle in the past sixteen years, he is the only one who asked about her situation, and is the only one she feels can break the curse. To break the curse, she tells him, one must sleep in a certain room within the castle from ten o'clock until midnight for three nights in a row. The Irishman agrees to help break the curse.
That night the Irishman goes to sleep in the appointed room. Soon thereafter there comes a loud pounding at the door. Several angry men demand entrance, but the Irishman refuses. The men break down the door and beat him mercilessly, though upon the stroke of midnight leave immediately. In the morning, the princess enters the room and rubs the Irishman's body with the contents of a strange bottle, after which he is fully healed.
The Irishman is reluctant to stay any further and contemplates leaving to avoid further mistreatment from the curse, but the princess urges him to stay, telling him the next night will be easier. He agrees, and locks himself in the room again that night. That night more men come; three for every one who was there the night before. They beat him severely, and in the morning he lies prone, unable to move until the princess uses the contents of the same bottle to heal him again. This time he is angry and refuses to stay further. The princess reminds him that it is only one more night until she is free, and that if he survives her bottle will fix all of his wounds. He agrees in the end to stay.
The third night he stays and is once again beaten by the men. In the morning, the princess thinks him dead, but discovers a faint pulse and revives him with the bottle. She tells him that the curse is broken and must depart, but will return shortly. She gives him a rod with which he can awaken the men asleep in the great hall. She vanishes before the Irishman can say anything. Later that day, while the Irishman is resting, a small, fair-haired boy arrives on orders of the princess to wait on the Irishman, and brings the message that the princess will arrive at nine o'clock in the morning and the Irishman must meet her in the castle garden. The Irishman awakens early in the morning, but the boy sticks a magic needle in his coat which makes him fall asleep. When the princess arrives, she is upset and tells the boy to tell the Irishman that if he does not show up the next day she will never see him there again.
The Irishman is furious when he awakens and vows to go to sleep earlier the next night, which he does. He wakes again the next morning, and once again, the fair-haired child sticks a magic needle in his coat which causes him to sleep. The Irishman misses the princess when she comes to the castle; she leaves a sword with the boy to give to the Irishman and tells him she will never return. The boy removes the needle and the Irishman awakens and plans to kill the boy out of rage, but the boy vanishes. The man decides to dedicate his life to finding the princess, and for the next three years searches for her.
Eventually the Irishman decides to take his own life. He draws the sword he was given by the princess to do so but notices that there is an inscription on the blade which reads "You will find me in the Blue Mountains." The Irishman finds a new will to live and decides to find the Blue Mountains and the princess.
Eventually he finds a house with an old man who claims to be 300 years old. The old man invites him to stay the night while he searches his ancient book on the Blue Mountains. The Irishman agrees, but in the morning the old man has found nothing. He offers to teleport the Irishman to his equally ancient brother who lives 900 miles away, an offer which the Irishman accepts. The Irishman repeats this offer with the second brother, but he does not find anything in his book either. He teleports the Irishman to the third ancient brother, who is the master of all birds.
The third brother calls all the birds to him, but only the eagle, who arrived last, knows where the Blue Mountains are. The eagle tells of an impending wedding between the princess and another man because the three years of waiting on the Irishman she negotiated with her father are up. The eagle agrees to fly the Irishman to the Blue Mountains if he will kill sixty cows and toss a quarter of the cow to her to eat when she turns her head while flying. This goes as planned until at the edge of the kingdom the Irishman runs out of beef and throws a rock instead. The eagle drops him in the water, and he swims ashore and enters a random house, which happens to be the house of the king's hen-keeper.
The Irishman hears from her that the wedding is about to begin, and gives her a gold piece and has her fetch the princess. The princess arrives and the two embrace. They are soon thereafter married, and their wedding lasts a year and a day.
- Hans Christian Andersen's "The Blue Mountains" in English on Wikisource.