Home invasion is the crime of entering a private and occupied dwelling, with the intent of committing a crime, often while threatening the resident of the dwelling. It is not a legally defined offense (federally) in the United States, but may be in Australia, and New Zealand, and applies even if entry is not forced. It can also apply if someone is invited into a home and remains on the premises after being asked to leave by the resident.
A Castle Doctrine (also known as a Castle Law or a Defense of Habitation Law) is an American legal doctrine that arose from English Common Law that designates one's place of residence (or, in some states, any place legally occupied, such as one's car or place of work) as a place in which one enjoys protection from illegal trespassing and violent attack. It then goes on to give a person the legal right to use deadly force to defend that place (his/her "castle"), and/or any other innocent persons legally inside it, from violent attack or an intrusion which may lead to violent attack. In a legal context, therefore, use of deadly force which actually results in death may be defended as justifiable homicide under the Castle Doctrine.
An intruder must be making (or have made) an attempt to unlawfully and/or forcibly enter an occupied home, business or car.
The intruder must be acting illegally—e.g. the Castle Doctrine does not give the right to attack officers of the law acting in the course of their legal duties
The occupant(s) of the home must reasonably believe that the intruder intends to inflict serious bodily harm or death upon an occupant of the home
The occupant(s) of the home must reasonably believe that the intruder intends to commit some other felony, such as arson or burglary
The occupant(s) of the home must not have provoked or instigated an intrusion, or provoked or instigated an intruder to threaten or use deadly force
The occupant(s) of the home may be required to attempt to exit the house or otherwise retreat (this is called the "Duty to retreat" and most self-defense statutes referred to as examples of "Castle Doctrine" expressly state that the homeowner has no such duty)
Other states expressly relieve the home's occupants of any duty to retreat or announce their intent to use deadly force before they can be legally justified in doing so to defend themselves.
Clauses that state this fact are called "Stand Your Ground", "Line In The Sand" or "No Duty To Retreat" clauses, and state exactly that the defender has no duty or other requirement to abandon a place in which they have a right to be, or to give up ground to an assailant.
I dont know where you live, but
Adoption by States
Alabama, Alaska, Arizona, Florida, Georgia, Indiana, Kansas, Kentucky, Louisiana, Maine, Massachusetts, Michigan, Mississippi, Missouri, North Dakota, Ohio, Oklahoma, South Carolina, South Dakota, Tennessee, Texas, Utah West Virginia and Wyoming have adopted Castle Doctrine statutes, and other states (Montana, Nebraska (http://www.nraila.org/Legislation/Read.aspx?ID=5348)
, New Hampshire, Pennsylvania and Washington) are currently considering "Stand Your Ground" laws of their own.