VIRGINIA BEACH, Va. — As he trembled and wiped away tears, former sailor Alec Wagner pleaded guilty this morning to accidentally shooting and killing an 18-year-old friend in 2016.

Wagner, now 24, entered a plea to involuntary manslaughter. He could get up to 10 years in prison and a $2,500 fine when he is sentenced in July.

Circuit Judge James Lewis agreed to allow him to remain free on bond until then, as long as he maintains a nighttime curfew and an order to stay away from guns.

About a dozen family members and friends of the victim, Aleigha Hawkingberry, attended the brief court hearing. Many appeared red-eyed and could be seen wiping away tears. They declined to discuss the case afterward.

Wagner's attorney, John Hooker Jr., said that while Wagner never intended to hurt his friend, he wanted to take responsibility for her death and be held accountable.

"From day one he has, and still to this day, expressed a tremendous amount of remorse and a tremendous amount of grief," Hooker said. "By pleading guilty he shows to himself and to the family that he accepts responsibility for his actions."

Wagner and Hawkingberry had known each other from Landstown High School, and had recently reconnected through Snapchat. Hawkingberry graduated from the school four months before her death.

Wagner told police the two were hanging out in his car the night of Oct. 4, 2016 when he took his .40-caliber handgun out of the glove compartment to show it off, according to a stipulation of facts entered in the case.

He put it in a pocket on the driver's side door afterward and drove Hawkingberry home.

Hawkingberry was standing outside the car, leaning towards the driver's window and talking to Wagner, when he took the gun out of the door pocket to return it to the glove compartment.

He told police Hawkingberry asked, "What are you going to do, shoot me?" when he pulled the gun out. He had his finger on the trigger and was moving to put the gun back in the glove compartment when he accidentally banged it on the steering wheel. The gun discharged, striking Hawkingberry in the neck.

Wagner called 911 and was kneeling over his friend, applying pressure to her neck, when emergency responders arrived. He was hysterical, yelling that it was an accident and that he did not mean to shoot her, according to the stipulation. Hawkingberry died at the scene.