A castle doctrine, also known as a castle law or a defense of habitation law, is a legal doctrine that designates a person's abode or any legally occupied place (for example, a vehicle or home) as a place in which that person has protections and immunities permitting one, in certain circumstances, to use force (up to and including deadly force) to defend oneself against an intruder, free from legal prosecution for the consequences of the force used. The term is most commonly used in the United States, though many other countries invoke comparable principles in their laws.
Depending on the location, a person may have a duty to retreat to avoid violence if one can reasonably do so. Castle doctrines lessen the duty to retreat when an individual is assaulted within one's own home. Deadly force may either be justified, the burdens of production and proof for charges impeded, or an affirmative defense against criminal homicide applicable, in cases "when the actor reasonably fears imminent peril of death or serious bodily harm to him or herself or another". The castle doctrine is not a defined law that can be invoked, but a set of principles which may be incorporated in some form in many jurisdictions. Castle doctrines may not provide civil immunity, such as from wrongful death suits, which have a much lower burden of proof.
Justifiable homicide in self-defense which happens to occur inside one's home is distinct, as a matter of law, from castle doctrine because the mere occurrence of trespassing—and occasionally a subjective requirement of fear—is sufficient to invoke the castle doctrine. The burden of proof of fact is much less challenging than that of justifying a homicide in self-defense. With justifiable homicide in self-defense, one generally must objectively prove to a trier of fact, against all reasonable doubt, the intent in the intruder's mind to commit violence or a felony. It would be a misconception of law to infer that because a state has a justifiable homicide in self-defense provision pertaining to one's domicile, it has a castle doctrine protecting the estate and exonerating any duty whatsoever to retreat therefrom. The doctrine can be misused as a pretext for extrajudicial punishment in private spaces.
Australia does not effectively have a Castle Doctrine but its principles are enshrined in Commonwealth, State and Territory laws.
In Northern Territory ~ Trespass Act 1987. https://legislation.nt.gov.au/en/Legislation/TRESPASS-ACT-1987
In South Australia ~ Section 15A ~ Criminal Law Consolidation Act 1935.
In Western Australia ~ Section 244 ~ Criminal Code Act Compilation Act 1913.
In New South Wales ~ Section 418 ~ Crimes Act 1900.
In Tasmania ~ Section 39 ~ Criminal Code 1924.
In Queensland ~ Section 267 ~ Criminal Code 1899.
In Victoria ~ Section 77A ~ Crimes Act 1958 & ~ Section 9 ~ Summary Offences Act 1966.