This is the expletive, as in “What the deuce!”
It has come to be synonymous with “the devil,” and is often used euphemistically for the stronger expression.
But there is every reason to believe that originally it meant the throw of two at dice, the lowest throw that one can make. In Low German that would be de duus.
A player after a series of such unlucky throws might become sufficiently irritated to exclaim, “De duus!” or “Wat de duus!”
The English expletive, “the deuce,” now three hundred years old, is believed to have come from this Low German exclamation.