Read your own post, Hitler was appointed, not elected.
It is very similar to the way that the President of the United States is elected. You may think you are voting for President, but you are actually voting for Electors that represent you in the Electoral College. They actually vote for the President.
All very legal, all very legitimate and all very much an elected official in a Constitutional Republic!