A Navy SEAL pleaded guilty Thursday in the hazing death of a Green Beret soldier, detailing the late-night plot to break into 34-year-old Army Staff Sgt. Logan Melgar's room with a sledgehammer, put him in a chokehold and restrain him with duct tape during a deployment in Africa.

In a pretrial agreement, Chief Special Warfare Operator Adam Matthews pleaded guilty to conspiracy to commit assault, unlawful entry, obstruction of justice and violating a general order by committing hazing. As part of the plea deal, prosecutors agreed to drop murder and involuntary manslaughter charges against him.

Following the agreement, a military judge sentenced Matthews to one year in military prison.

2 NAVY SEALS, 2 MARINES CHARGED IN GREEN BERET'S MURDER

Matthews said that he, along with another member of the Navy’s SEAL Team 6 and two elite Marine Raiders, carried out the "juvenile" attack on June 4, 2017, in Bamako, Mali's capital.

The service members are also accused of lying to Navy commanders and investigators about what happened.

Ahead of Thursday's hearing, Matthews’ attorney, Grover Baxley, said his client "looks forward to detailing what happened that night in Mali almost 2 years ago and hopes that his explanation of events will assist the Melgar family in finding some semblance of closure."

He added that Melgar’s death was "an unforeseen accident that has dramatically impacted the lives of everyone involved. SOC Matthews is eager to assist with the Navy’s resolution of this case and then attempting to move on with his life.”

In an earlier statement to Military Times, Matthews' attorney said he didn't believe his client nor the three other men accused meant to kill Melgar.

“I don’t believe any of these four men did. This was an avoidable tragedy, and SSgt Maxwell is deeply remorseful for his role in it,” Maxwell’s other attorney, Brian Bouffard, wrote in an email.

Even though Melgar died in June 2017, the Pentagon did not release any information regarding his death until news outlets broke the story several months later.

According to The Washington Post, the tragedy occurred after a long night of drinking and partying. Two SEALs and two Marine Raiders smashed their way into Melgar's room with a sledgehammer because they purportedly wanted to teach him a lesson for leaving them behind in traffic on the way to a party at the French Embassy.

CLICK HERE FOR THE FOX NEWS APP

One of the SEALs, Petty Officer 1st Class Anthony E. DeDolph, jumped on Melgar and put him in a chokehold while Matthews grabbed Melgar’s legs. The two Marines then duct-taped his legs together. When they moved on to Melgar's wrists, they realized he had stopped breathing.

The case, including allegations of a coverup, shed light on the culture of heavy drinking and womanizing in a West African city where there are alcohol restrictions and warnings about terrorist threats.