A viceroy (from Latin vice- [in the place of] and French roi [a king]) is the ranking officer of a kingdom who governs a province of that kingdom, or even the entire kingdom, in the name of the regnant king and as if he were the king. It is the highest office, other than the actual kingship, to which any officer can aspire.
A vicereine is any woman holding that office, or the wife of a male viceroy.
The actual title of viceroy dates back to 14th-century Spain and the Spanish Empire in Latin America. At least two officers of the Commonwealth of Nations were viceroys. But the office itself, with all its prerogatives, was frequently held in ancient times. Some of the most powerful kings of Israel and elsewhere in the Middle East once served as viceroys. Joseph was a viceroy in all but name in ancient Egypt for eighty years.