Depends on what was described above. However it more than likely would be taken pending potential charges. It would be up to you to keep on top of the many hurdles and even fees they create to get it back (like paying for a new background check before your legaly registered weapon is returned, yes they do that in CA, even if it is confiscated or taken routinely by no fault of your own). Many places have a time limit from the day it is no longer needed (which will not be on your timeline) as evidence to its "destruction" date where it is destroyed, sold, transfered, or otherwise never to be returned to you.
That said the court costs of any defensive case that goes to court will be many many times the value of the firearm. The "victim's" family's civil case will likely cost at least as much to win if that is pursued. All the while your gun will be destroyed 30-90 (depending on location and policy) days after the time it ceases to be evidence in many places which they will not announce or make you aware of. So magicly one day your firearm will start a countdown until destruction. It may be a year after the incident, maybe 15months, maybe several years.
If you do attempt to keep on top of it you may still get misinformation, not find out about the start of the countdown or have other issues that are commonplace in our justice system where various agencies and policies and the representatives of those agencies do not know or understand half of what is going on themselves, nevermind help to keep you clearly informed. So even attempting to keep on top of it may result in you finding out after the fact that it was "destroyed" (has a new home.) Or you may get responsive professional information and have little to no problems. It all depends on the bureaucracy of your local system.
Just because you're are on the right side of the law does not mean you will feel like a winner in the end
Innocent people also go to prison as well, so even if justified you still have somewhat of a gamble taking place. Here is a list of some of the potential outcomes:
1. You could lose the criminal trial for murder.
2.Some jury could decide to "compromise" with your life to make the "victim's" family feel better (because you better believe they will have stories of thier wonderful young man whose life you ended) and just give you a lesser charge that gives you a few years and still makes you a felon even for a just shoot.
3.You could win the criminal case as a just shoot, and then lose everything in the civil case the impoverished family of the individual attempting to victimize you sees as thier final chance to strike it rich, or just plain punish you for thier loss, losing everything you have ever earned and owing more for years or the rest of your life.
4.You could win both criminal and civil and just have tens of thousands in attorney fees to pay off.
5.Or they could just decide not to let the courts find the facts and rule it just at the time.
Big gamble, your firearm is likely to be one of the least of the concerns. Once you defend yourself your role as a victim will likely have just started.