Well this is actually the thing - history is both a science and an art, and that's what I love.
On the one hand, it's a science in the sense that there are rules which cannot be broken. Like in science, where in order to have a fair test, you also need to have done the test at least three times and taken an average (maybe even evaluate them for outliers), in history you have to do the same. You have to look through all the sources of many varieties, and interpret what it means for your thesis. Will you have to reject or accept your thesis?
But you also have the fact that in a sense, every historical 'fact' is an anomaly, because every single one is flawed, so unlike in science you can never reach objective fact.
But you still need to illustrate what likely happened - What is history if it can't actually convey what happened in the past, to the present day audience? Nothing. So it is literature in itself. But bound by the many rules of science.
So it's evidently both