Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A former St. Louis police officer, accused of fatally shooting his off-duty colleague while playing a game with a revolver, changed his plea to guilty on Friday.

Nathaniel Hendren had in April pleaded not guilty to involuntary manslaughter and armed criminal action for the Jan. 24, 2019, fatal shooting of Officer Katlyn Alix, who was off duty when she was killed. But Hendren and prosecutors agreed on a guilty plea Friday.

Hendren, who was 29 at the time of the fatal incident, agreed to serve seven years in prison, according to NBC affiliate KSDK.

This undated photo released by the St. Louis Police Department shows officer Katlyn Alix. St. Louis Police Department / AP

Alix's mother met with the judge before Hendren's court appearance. Later, during the guilty plea hearing, Hendren apologized to her.

"I hope in some small way it can help heal the brokenness I've caused," Hendren told her.

Hendren and at least one other on-duty officer with the St. Louis Metropolitan Police Department were in his house with Alix, 24, when she was shot just before 1 a.m.

A probable cause statement said that Hendren and Alix were "playing with firearms when the defendant produced a revolver."

Hendren allegedly emptied the cylinder of the gun and then put one cartridge back into the cylinder, spun the cylinder and pointed the weapon away and pulled the trigger. The revolver did not fire.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Alix then took the gun and pointed it at Hendren and pulled the trigger, according to the probable cause statement. The revolver once again did not fire.

Hendren "took the gun back and pointed it at the victim pulled the trigger causing the gun to discharge," the probable cause statement reads. Alix was shot in the chest.

Hendren and the other officer rushed Alix to a hospital, where she was pronounced dead.

As police investigated, so did the Circuit Attorney’s Office, as is protocol with police shootings. Hendren was charged the next day.

Officer Nathaniel Hendren was charged with involuntary manslaughter after shooting St. Louis Police Officer Katlyn Alix in Missouri. Jefferson County Sheriff's Office

Circuit Attorney Kim Gardner later sent a letter to the police department, accusing them of using an "obstructionist tactic to prevent us from understanding the state of the officers during the commission of this alleged crime."

She alleged that the police department failed to take blood draws on the involved officers, when "drugs or alcohol may be a contributing factor in a potential crime."

Gardner also said that police were too hasty to call the incident accidental. In the hours after Alix's killing, St. Louis Police Chief John Hayden called it an "accidental discharge of a weapon.”

Hendren’s attorney, Talmage E. Newton IV, had also called the shooting a "tragic accident" while defending his client.

At the end of January 2019, the St. Louis police department released an "allegation of employee misconduct report," which said Hendren and the officer with him were drinking on duty when Alix was shot.

The casket of St. Louis Police Officer Katlyn Alix is carried out of the Cathedral Basilica of St. Louis after her funeral on Jan. 30, 2019. David Carson / St. Louis Post-Dispatch via AP

At the time, Hayden said commanders had been ordered to keep a closer eye on officers in the field. He also angrily responded to Gardner's charges.

"Let it be crystal clear that the accusation launched by the circuit attorney to say the least was both offensive and insulting to the force investigative unit and myself," Hayden said.

Alix is survived by her husband, mother, father and sister. The family in October filed a wrongful death lawsuit against Hendren, the officer he was with, the police sergeant on duty, and the City of St. Louis, according to KSDK.

"This world lost a lot," her father, Ron Alix, said last year. "When we lost Katie, we lost a lot."

The lawsuit alleged that Hendren had suffered from anxiety, depression, PTSD, and suicidal ideation and had "a history of acting recklessly with firearms, forcing previous girlfriends to play 'Russian roulette' and engage in other sexual activity that involved firearms."

The suit said the city was negligent when it hired Hendren about a year before the shooting because it should have been aware of his past.

Before pleading guilty on Friday, Hendren was under house arrest on a $100,000 bond. He was placed on administrative suspension, which is always unpaid, after the shooting. Later, his peace officer license was later suspended, meaning he cannot work as a police officer.