There is a tremendous debate regarding the actions of the Chashmonaim in taking the kingship following their victory against the Greeks and the subsequent miracle of the oil. Both the Rambam and the Ramban agree that their actions were incorrect, however they are at different ends of the spectrum of severity.
The Rambam writes that if someone is anointed to be the king by a Navi during Bayit Rishon or the Sanhedrin during Bayit Sheni his kingship is valid unless he is from the tribe of Levi. He then continues to say that although he disagrees with the actions of the Chashmonaim, he is not in a position to chastise them because they saved the Torah.
On the other hand, the Ramban says that the Chashmonaim were wiped out because they took the kingship. Firstly, they were forbidden from taking the kingship from Yehuda because it says in Parshat Vayechi (49:10), “Lo Yasur Shevet MiYehudah.” Secondly, he says that when it says in Parshat Shoftim (18:1), “Lo Yihiyeh LaCohanim… Chelek V’Nachala Im Yisrael”, not only does this apply to the land the tribes would get, but to the laws discussed in the previous paragraph: kingship. Therefore, by taking the kingship, the Chashmonaim sinned by disregarding this Halacha and were punished accordingly.
However, it seems a little odd that the Kohanim are excluded from the kingship. In explanation, Rav Soloveitchik cited the Mishnah in Pirkei Avot (4:13) which says that there are three crowns, or titles, in Judaism: kingship, Kehuna and Torah, and the only one which can be acquired by anyone is Keter Torah. Therefore, if the kingship and the Kehuna are clearly demarcated, they may not be brought together. The reason for this is the national need to have leaders in different areas of life. The Talmud Yerushalmi explains that the reason the Kohanim can’t be kings is that they have to do the Avodah in the Mikdash. In other words, they already have a job. Another aspect of that job is to be the spiritual leaders of Bnei Yisrael. On the other hand, the job of the king is to take care of the political needs of the country. Therefore, if the two jobs are joined, the leader will be unable to properly do both and the nation will suffer because of it. Therefore, everyone agrees that the actions of the Chashmonaim were improper. However, the Rambam accords them special respect because of their previous actions, whereas the Ramban says that although their previous actions were vital to the survival of Bnei Yisrael, their actions now may well destroy it, and they were therefore destroyed.