Hamas did once win an election, but that was eight years ago.
There is no democracy in Gaza now.
The opposition were murdered or fled.
Hamas do carry out terrorist attacks on ordinary civilians so they are a terrorist organisation and recognised as such by real democracies.