*Whilst schools, churches, hospitals and CNI all have protected status under the Law of Armed Conflict, that status is lost if they are being used for "military purposes"
Not 100% accurate. The protections differ slightly between schools, churches and medical, but for hospitals it’s not if they are being used for “military purposes” but if they are being used to commit “an act harmful to the enemy” which is very much more specific.
“Specific protection of medical establishments and units (including hospitals) is the general rule under IHL. Therefore, specific protection to which hospitals are entitled shall not cease unless they are used by a party to the conflict to commit, outside their humanitarian functions, an "act harmful to the enemy". In case of doubt as to whether medical units of establishments are used to commit an "act harmful to the enemy", they should be presumed not to be so used.
The expression "act harmful to the enemy" is not defined under IHL. This body of law merely singles out a few acts expressly recognized as not being harmful to the enemy, such as the carrying or using of individual light weapon in self-defense or defense of wounded and sick; armed guarding of a medical facility; or the presence in a medical facility of sick or wounded combatants no longer taking part in hostilities.
Notwithstanding the lack of an agreed definition, the rationale for a loss of protection is clear. Medical establishments and units enjoy protection because of their function of providing care for the wounded and sick. When they are used to interfere directly or indirectly in military operations, and thereby cause harm to the enemy, the rationale for their specific protection is removed. This would be the case for example if a hospital is used as a base from which to launch an attack; as an observation post to transmit information of military value; as a weapons depot; as a center for liaison with fighting troops; or as a shelter for able-bodied combatants.”
”Before carrying out an attack on a medical establishment or unit that has lost its protected status, a warning must be given. Where appropriate, this should include a time limit, which must go unheeded before an attack is permitted. The purpose of issuing a warning is to allow those committing an "act harmful to the enemy" to terminate such act, or – if they persist – to ultimately allow for safe evacuation of the wounded and sick who are not responsible for such conduct and who should not become the victims of it.
Where such a warning has remained unheeded, the enemy is no longer obliged to refrain from interfering with the work of a medical establishment or unit, or to take positive measures to assist it in its work. Even then, humanitarian considerations relating to the welfare of the wounded and sick being cared for in the facility may not be disregarded. They must be spared and, as far as possible, active measures for their safety taken.
This derives from the obligation to respect and protect the wounded and sick as well as the general rules on the conduct of hostilities that apply to attacks on any military objective. Notably, an attacking party remains bound by the principle of proportionality. The military advantage likely to be gained from attacking medical establishments or units that have lost their protected status should be carefully weighed against the humanitarian consequences likely to result from the damage or destruction caused to those facilities: such an attack may have significant incidental second- and third-order effects on the delivery of health care in the short, middle and long-term.
An attacking party remains also bound by the obligation to take precautions in attack, in particular to do everything feasible to avoid or at least minimize harm to patients and medical personnel who may have nothing to do with those acts and for whom the humanitarian consequences will be especially dire. The following measures should be taken to minimize the direct and indirect impact of such an attack on the provision of health-care services, whenever feasible and operationally relevant:
• Prepare a contingency plan to address the estimated disruption to health-care services and to re-establish full delivery as soon as possible.
• Consider measures both for the evacuation of patients and medical personnel and for them to be taken properly in charge.
• Interrupt the attack if the facility no longer meets the criteria leading to the loss of protected status (e.g. combatants have fled from the medical facility).
• After the attack, facilitate or implement measures for the rapid restoration of health-care services (e.g. provide military medical support for the civilian medical facility).”
https://www.icrc.org/en/document/protection-hospitals-during-armed-conflicts-what-law-says