"You may not set a stranger over you who is not your brother"Deuteronomy 17:15.

We are forbidden to appoint a king who is not from Jewish ancestry, even if he is a righteous convert. To be eligible for the position, the individual must have been born to a Jewish mother.

The same is true with regards to all appointments – whether governmental or Torah-related – only one with Jewish ancestry may be appointed.

This all applied until King David became king. From that point and onwards, only a descendant of King David (specifically through his son Solomon) is eligible to be king. Anyone other than a descendant of David is considered a "stranger" with regards to kingship, as is anyone not of Aaron's seed with relation to priesthood.