King Agilulf of Lombardy marries Theodolinda, the beautiful widow of the former king.
But a lovely Queen doesn't go long without an admirer and Theodolinda's no exception.
Her lover is of incredibly low social status, but also capable and handsome.
He's also not stupid, so he keeps his love to himself. Instead, he tries to do things for the Queen that will attract her notice.
The Queen shows him a small bit of favor by always choosing the horse under his care to ride.
But that's all the hope the groom gets, and pretty soon, it just isn't enough. His love burns even hotter and he determines to die if he can't have her.
But he's going to do it in such a way that a) The Queen knows the reason he died and b) he'll be able to get what he wants from the Queen just before he dies.
The groom decides that the best way to do this is to impersonate the King. They're the same height, after all.
So the groom hides in the palace to study what the King wears and how he behaves when he approaches the Queen's chamber for the night.
The groom finds a cloak similar to the King's and chooses a stick so that he can bang on her door the way the King does. Then he takes a nice bath so that he doesn't offend with his odor.
And guess what? His plan works. He manages to "enjoy" the Queen multiple times in one night.
After he leaves, the Queen gets a surprise visit from the real King, who is feeling very rested and ready to make a night of it.
The Queen tells him that he should really take it easy; he might hurt himself if he does too much "work" in the evenings.
Agilulf immediately understands what must have happened, but keeps quiet. He can tell that the Queen has no idea that she'd been duped.
Later on, Agilulf makes his way to the servants' quarters so that he can check the heart rate of the "sleeping" servants. Surely, the guilty party would still be pumped up after that exertion?
When he reaches the groom, he knows he's got his man. But he's still concerned for his wife's (and his own) reputation, so he doesn't make a fuss.
Instead, he grabs a pair of shears and cuts off a lock of the groom's hair so that he can identify him in the morning.
The groom, meanwhile, is really awake but pretending not to see what the King's doing. After Agilulf leaves, the groom comes up with an ingenious plan: he'll just cut a lock of hair off of all the sleeping servants.
So when the King lines them up the next morning, he finds that all the servants have the same lock of hair cut off. He can't identify the perp.
Agilulf realizes that his adversary is clever and—still concerned about his reputation—issues a general warning and leaves it at that.
In doing this, King Agilulf scores a point: he doesn't distress his wife or reveal his shame but makes sure that the groom knows his moves and won't allow him to get away with those shenanigans again.