That was because they opposed God and His Messenger, and if anyone opposes God and His Messenger, God punishes them severely-
This because they contended against Allah and His Messenger: If any contend against Allah and His Messenger, Allah is strict in punishment.