James is a terrorist organisation, but they are also the government.
It is no different to Nelson Mandela being in prison as a terrorist and later the leader of South Africa.
That is not to justify Hamas actions, but the health ministry is the one saving people, not killing people.