Melgar and the other special operations service members were in Mali as part of a counter-terrorism mission in the region.
In a U.S. Navy courtroom in Norfolk, Virginia on Thursday, Matthews pleaded guilty as part of a deal that reduced the charges he faced to hazing, assault consummated by battery, burglary and conspiracy to obstruct justice, in return for cooperation in the prosecution of the other three service members. A Navy spokesman said Matthews pleaded guilty to only some of the charges in the plea deal.
"I can't describe how sorry I am for the death of Staff Sergeant Melgar," Matthews told the court, according to the Associated Press. "I am truly sorry."
Ahead of the courtroom appearance, Grover Baxley, Matthews' attorney, told ABC News that, "He looks forward to detailing what happened that night in Mali almost two years ago, and hopes that his explanation of events will assist the Melgar family in finding some semblance of closure."
In November, Matthews was one of two members of SEAL Team 6 and two special operations Marines charged in Melgar's death. The cases against the other three service members were still pending. If convicted, they face the possibility of life in prison without parole.
As part of the plea deal, Matthews' case was heard by a special court-martial, which limits the maximum prison sentence for any conviction to one year in jail, a reduction in rank and a loss of wages. The sentencing phase of the case was scheduled to take place on Thursday afternoon.
Thursday's court hearing was the first opportunity to learn about the motive behind the incident.
Matthews said he had agreed to help the other three defendants in hazing Melgar over perceived slights against his colleagues, according to the Associated Press.
The night of June 4, 2017, Mattthews said the group broke down the door to Melgar's quarters with with a sledgehammer and planned to bind the Green Beret's wrists and ankles with duct tape. It was all part of a hazing ritual known as "known remediation" intended to embarrass Melgar for behavior that they felt showed he was not a team player.
The other Navy SEAL placed Melgar in a chokehold, but the Army Green Beret became unresponsive and could not be resuscitated, Matthews said in court, according to the AP.
Baxley said that during the sentencing phase of the hearing he intended to make a "robust presentation focused on Matthews' exceptional military career."
"Our position is that Melgar is a hero and that this was a tragic and unforeseen accident," said Baxley.