Scene 1: A hall in the royal palace
Courtiers awaiting the arrival of the king sing his praises, while malcontents conspire to bring about his downfall.
Gustavus contemplates the responsibilities of kingship. The page Oscar hands him a list of guests for a ball; seeing the name of Amelia, he looks forward to seeing her again.
His secretary Anckarstroem, Amelia's husband, warns him that there is a conspiracy afoot; but Gustavus, relieved that Anckarstroem has not discovered his passion for his wife, averse to shedding blood and confident in the love of his people, is unconcerned. Anckarstroem warns him against overconfidence and urges him to preserve his life for the sake of his people.
The chief justice brings an order of banishment against the fortune-teller Mademoiselle Arvidson for the king to sign. Oscar defends her and Gustavus decides to see for himself, telling Oscar to get him a fisherman's costume as a disguise and summoning the court to meet him at Mlle Arvidson's at three.
The conspirators hope to get a chance to kill him and the rest of the court, led by Gustavus, look forward to an entertaining afternoon.
Scene 2: The fortune-teller's den
People gather to have their fortunes told, while Mlle Arvidson invokes the devil to aid her power of prophecy.
The disguised king mingles with the crowd in time to hear a sailor, Cristian, ask what will be his reward for years of faithful service to the king. The fortune-teller promises him money and promotion, and the king, to prove her right, slips a note to this effect into Cristian's pocket. When he finds it all are impressed with the accuracy of the prophecy.
Amelia comes to ask Mlle Arvidson for a prescription which will free her from the guilty love she feels for the king and Gustavus, overhearing Mlle Arvidson instruct her to pick at midnight a herb growing beneath the gallows, resolves to be there as well.
The rest of the court arrives, not recognising the king, although he reveals his identity to Oscar and orders him to keep the secret. Still in disguise, the king asks the fortune-teller to say whether he will be lucky in love and at sea. When she looks at his hand, she recognises that he is a great man; then frightened by what she sees, refuses to continue. He insists and she tells him that he will die soon and at the hand of a friend.
Gustavus is derisive, Oscar and the bystanders filled with dread and the conspirators nervous. She repeats the warning and then identifies the murderer as the next man to shake him by the hand. Gustavus offers his hand in vain to the courtiers and conspirators, but when the unsuspecting Anckarstroem arrives, he takes the hand, thus proving to the king's satisfaction the falseness of the prophecy as Anckarstroem is his best friend.
Mlle Arvidson now recognises him with fear and he reminds her that she had been unable to penetrate his disguise or divine that he had been on the point of banishing her. He soothes her fears and she reiterates her warning, adding, to the alarm of the conspirators, that more than one traitor is lurking.
Cristian leads the bystanders in a hymn of praise to the king.
The gallows outside the city at midnight
Amelia, almost overcome with terror, comes to pick the herb. Gustavus comes and declares his love, but she reminds him that she is the wife of a man who would give his life for him. Gustavus admits that he is consumed with remorse, but the power of his love is stronger and Amelia finally confesses that she loves him.
Their ecstasy is cut short by the arrival of Anckarstroem, warning that there are conspirators close by. He manages to persuade the king to leave by a safe path and promises to escort the now-veiled Amelia to the city wihtout trying to uncover her identity.
The conspirators surround Anckarstroem and Amelia and, realising that their prey has eluded them, insist on knowing the identity of the lady. Anckarstroem is prepared to fight to prevent this but Amelia, trying to intervene, drops her veil.
The conspirators are diverted at the strange time and place Anckarstroem has chosen for an assignation with his own wife; and he, furious at having been betrayed by his wife and his friend, asks their leaders, Counts Rigging and Horn, to come to his house the next day.
Scene 1: Anckarstroem's study
Anckarstroem is adamant that Amelia must die, despite her assurances that her love for the king is innocent. She begs to see her son for the last time, and he sends her out, turning bitterly to the portrait of the king on the wall and blaming him for having seduced Amelia.
Counts Ribbing and Horn arrive, and Anckarstroem assures them that he does not wish to denounce them, but rather to join them, and even to be allowed to be the one to kill the king. When they insist on their prior claims, he suggests they draw lots.
Amelia comes in to announce the arrival of Oscar with an invitation from the king and Anckarstroem makes her draw the chosen name. It is his and his fierce joy makes her suspect the worst.
Oscar delivers the invitation to a masked ball. Amelia wishes to decline, but Anckarstroem, eager for revenge, accepts for them both. The conspirators agree on a costume and a password (Death) while Amelia tries to think of a way of warning the king.
Scene 2: The king's study
Although in despair at the thought of parting from Amelia, Gustavus forces himself to sign a document sending Anckarstroem and Amelia on a mission to Finland, without even seeing Amelia once more to say farewell.
Oscar brings a letter from a veiled lady warning Gustavus not to attend the ball, as his life is in danger. Refusing to run the risk of being thought a coward and resolving to see Amelia once more, he decides to attend the ball.
Scene 3: The Royal Opera House, Stockholm
The ball is in progress and the conspirators search in vain for Gustavus until Oscar, persuaded by Anckarstroem that his business is urgent, describes the king's costume. Amelia, disguised, tries to warn Gustavus, but he recognises her and tells her that he has resolved to send her away with her husband. They bid each other farewell as Anckarstroem stabs the king.
Gustavus restrains the crowd from taking vengeance and tells the now remorseful Anckarstroem that his wife is innocent and that he had planned to send them away. He dies, forgiving his enemies.