"But rather" or "but instead", both are good at describing the situation. I wonder about the etymology of the word "hanem". It may be just a coincidence that it can be split into "ha" ( = if ) and "nem" ( = not ). The usage is not to be confused with "ha nem"
It is worthwhile noting that the "hanem" part always contradicts a previous negated statement.
Not (one statement) but instead (a different statement).