Key Points:

A Massey University student who accidentally shot a friend while out hunting possums has escaped conviction in what a judge called a unique and unprecedented case.

Judge Grant Fraser also prohibited publication of the student's name when he appeared before him in Palmerston North District Court on Friday.

The student was ordered to pay the victim, whom Judge Fraser said had made "miraculous" recovery, $5000 for emotional harm.

Judge Fraser said a light trigger on the .22 rifle was the likely cause of the accident in September last year, which occurred after the defendant thought it had jammed and began working the bolt.

As he did this, he pointed the gun at his friends, who were standing in a nearby ute, shooting one of them in the back of the head.

The defendant admitted causing bodily injury through careless use of a firearm, which carries maximum penalties of three years' jail or a $4000 fine.

Judge Fraser said the "immediate response" of the defendant and his friends after the shooting probably saved the victim's life.

A conviction would be "out of all proportion to the gravity of the offending".

It wasn't a case of "horseplay or real carelessness".

He added that publication of the defendant's name would hamper his ability to "move forward" and would impact on his rehabilitation.