When the old miller dies, he leaves the mill to the eldest son, the donkey to the second eldest and a tomcat to the youngest. The tomcat wants to repay his master's friendship and help him. He has his boots made, gains access to the royal castle and catches the partridges the king wants. He impersonates the miller's boy Hans as "Count of the Mill", tricks him into wearing elegant clothes and brings him together with the king and the princess. He succeeds in overcoming the evil sorcerer and winning a magnificent castle for Hans. Hans finally becomes king and his cat first minister.