Since I'm in charge of the evidence room at the PD I work for, I'll give my $0.02 about the way it would go at my PD.
If you shoot someone, even if it seems to be completely legit, the gun will be taken as evidence. It will be shot 2-3 times to verify functionality then logged into the evidence room. Even if the shoot seems legit, the case will be run through the County Grand Jury. If the GJ returns a no bill (Grand Jury's version of not guilty), that should be the end of it and, as soon as an order is received at the PD from the Prosecutor, the gun will be returned to you.
If the GJ returns an indictment, the case moves on to court. If you go to court and are found not guilty, the gun will probably be returned to you upon receipt of an order from the court, although there have been cases where the person is found not guilty but the judge ordered the gun destroyed anyway (I don't know the particulars, might have been part of a deal to the Defendant). If you are found guilty, the gun is either destroyed or, if "suitable for PD use", is permanently forfeited to the PD. We've only done this a few times and the guns were either used for duty use in one case or was used for issue to an Officer whose gun had to go back to the manufacturer in a few cases. In fact, we currently have a Springfield XD subcompact 9mm in the safe that was forfeited, but to date no one wants to carry it.
Either way, if it goes to court, based on how long it takes court cases to move through our court system, it is likely to be at least 2 years, and more probably 3 years, before you would be found not guilty and could even hope to have the gun returned. Court proceedings take time and the gun WILL be held for evidence until the court case is concluded.
Keep in mind, that's the way it goes here and I've vastly simplified the way it works. Your jurisdiction could be and probably is different, but it should give you at least an idea of what might happen. Remember, if you ever have to shoot someone, it is a really good idea to have another gun that you can use, unless for whatever reason the PD also takes your other guns, which has also happened in the past.
Bub75