If there's a stranger trying to break into your house in the middle of the night, the intricacies of the law are probably the last thing on your mind.
But your actions in the moment could determine whether you are plunged into a legal minefield, says an experienced defence lawyer.
One Queensland home owner may be facing a long wait to determine whether or not they could face charges, after a 36-year-old woman died on the Gold Coast this week after being found in a home that wasn't hers.
What happened?
Police say the woman entered the yard of a duplex in the early hours of Tuesday.
When the home owners awoke, she was restrained and held to the ground, police say.
She died at the scene and a man involved was hospitalised for shock.
Police say investigations are underway into how the woman came to be on the property and the cause of her death.
At a press conference, police could not say whether the woman was armed or if she was trying to get into the home.
A report will be prepared for the coroner.
Can I protect my home from intruders?
It all depends on what's "reasonably necessary in all of the circumstances".
That's according to former Queensland Law Society president Bill Potts, who has been practising in the state for more than 40 years.
He says the law in Queensland allows home owners to use force to remove a trespasser.
But he stresses that there are huge risks associated with doing so.
"The theory is every person's house is their castle, and in theory is inviolable, unless someone has a lawful right of entry," Mr Potts says.
"What that means is you can use force to remove trespassers or defend your property or your own body to the extent, and this is a quote, 'that is reasonably necessary in all of the circumstances'."
But he says that is open to a broad interpretation.
"[It] has a very, very wide meaning," Mr Potts says.
"For example, I might think that one punch is reasonable, but you might think that two punches are reasonable.
"But the point of it is that the extent to which it is reasonable is a question effectively of fact."
For example, Mr Potts says if someone invaded your property by placing a toe over the fence line, it would not be reasonably necessary for you to shoot them.
Still confused?
This is what makes defending your property so complicated.
Mr Potts says it can be especially difficult in the heat of the moment.
"This is a complete mess, because any house owner, any house occupant, at the point of seeing a distressed person in their yard is hardly thinking about what the law is," he says.
If someone refuses to leave your home, he says the best thing to do is call the police.
"Well-meaning as you may well be, [physically restraining intruders] might in fact be breaching the criminal law and it then becomes a question for a jury to determine what should happen to you," he says.
"You might be breaching the law by unlawfully detaining them, assaulting them, or … there may be the suggestion that someone's been unlawfully killed.
"Either way, a person, well-meaning, well intentioned, [someone] defending their own property may well find themselves in court having to explain why their behaviour was reasonably necessary in all of the circumstances."
Police, on the other hand, have legal protections.
"Call the professionals, because they are trained, they also have the right equipment to subdue or restrain if necessary, but more importantly they have the legal right to arrest," Mr Potts says.
"And whilst we hear about citizens' arrest powers they are extremely dangerous to implement.
"Well-meaning, well-intentioned and right in all of the circumstances, you might find yourself in court defending something. It's too great a burden."
When might a coroner get involved?
The coroner investigates deaths that are legally required to be reported to them.
If the coroner thinks there is anyone who has committed a crime, they can refer that to police or the Department of Public Prosecutions to determine whether they will prosecute any case.
He said the coroner can also place "riders" on their recommendations.
"A rider is to make recommendations to prevent deaths from occurring in the future in the same way," he said.
Australia's laws differ to those in the US
"In some places in America, they have laws that allow people to shoot people on their property. We don't have that," Mr Potts says.
"Our entire law has always been about what they call 'reasonableness', and what is reasonable will depend on all of the circumstances.
"It's all very well for anonymous armchair warriors to beat their chests and claim how tough they are — but the legal reality is in fact a minefield."
He says Queenslanders have been prosecuted for deaths that have occurred as a result of people protecting their property.
"For example, there have been people who have been prosecuted in exactly this kind of position, where they were defending their property," he says.
What does the law actually say?
Here's a relevant section of the law in Queensland. You can read the whole criminal code here.