A duke (male) (British English: /djuːk/ or American English: /duːk/) or duchess (female) can either be a monarch ruling over a duchy or a member of the nobility, historically of highest rank below the monarch. The title comes from French duc, itself from the Latin dux, 'leader', a term used in republican Rome to refer to a military commander without an official rank (particularly one of Germanic or Celtic origin), and later coming to mean the leading military commander of a province.
The title dux survived in the Eastern Roman Empire where it was used in several contexts signifying a rank equivalent to a captain or general. Later on, in the 11th century, the title Megas Doux was introduced for the post of commander-in-chief of the entire navy.
During the Middle Ages the title (as Herzog) signified first among the Germanic monarchies. Dukes were the rulers of the provinces and the superiors of the counts in the cities and later, in the feudal monarchies, the highest-ranking peers of the king. A duke may or may not be, ipso facto, a member of the nation's peerage: in the United Kingdom and Spain all dukes are/were also peers of the realm, in France some were and some were not, while the term is not applicable to dukedoms of other nations, even where an institution similar to the peerage (e.g., Grandeeship, Imperial Diet, Hungarian House of Magnates) existed.