The will of an eccentric old man says his castle with three towers will belong to whoever manages to spend one night in it. Scrooge McDuck tries it, but Donald impedes it using a trick. In fact, Donald wants to turn the castle into the Duck Avenger's secret lair. After finding the trick, Scrooge kicks Donald out of his house. Donald insults some cops and ends jailed for 30 days.
Donald gets an idea and calls the guard. He states that he needs his pajama and soap to remain there for 30 days. The guards escort him to his house where he gets these items and also a two-colored pen to write his memories.
Meanwhile, Huey, Dewey and Louie criticize Scrooge for leaving Donald in jail. Scrooge answers he will leave Donald there just one night so he can't impede a second attempt to get the castle. Gladstone Gander and a police escort will also be there because a lot of people will go to see if they can meet the castle ghost.
In jail, Donald leaves some sheets in his bed as a decoy, while he uses the red half of the pen, which cuts metals, to cut the window bars and escape. Then he goes back home and becomes the Duck Avenger.
Out of the castle, Scrooge sends Gladstone with a gun to see if there's a ghost. The Duck Avenger uses smoke and disguises himself as a ghost, but Gladstone believes it's just a projection and shoots it. Luckily, the Avenger was wearing chainmail. Gladstone cowardly begs mercy and the "ghost" kicks him out of the castle and reveals to be the Duck Avenger, and then declares himself the heir of the castle, which the major accepts. The Avenger then declares only "his friend" Donald can enter, and punishes Scrooge for jailing Donald by having hem forgive all of Donald's debtes, to which Huey declares they are witnesses of the promise.
The Duck Avenger turns back into Donald, returns to his cell and uses the blue part of his pen to weld the bars. Later, Scrooge arrives to free Donald, forgive his debts and renounce to kicking him out of the house. As Donald doesn't ask further indemnization, he's called a model citizen. His nephews tell Donald that sometimes they think he may be the Duck Avenger, and Donald feels flattered.