A Stillwater prison inmate was charged Thursday with murder in connection with the killing of a state corrections officer last month, but the motive behind the violence remains undisclosed.

Edward Muhammad Johnson, 42, who was already serving time for a previous slaying, was charged in Washington County District Court with intentional second-degree murder and second-degree assault. He was moved to the more restrictive Oak Park Heights prison soon after the July 18 death of officer Joseph Gomm in a vocational building, where offenders take welding classes.

Gomm was bludgeoned with a hammer and stabbed, leaving him with "substantial injuries to his head and face, and two puncture wounds to his chest, the charges disclosed.

What they don't disclose is what allegedly set off Johnson, who has a long history of violence that continued with his incarceration.

The County Attorney's Office said it will make no comment about the case until after Johnson makes his first court appearance, which is scheduled for 10 a.m. Friday.

According to the criminal complaint:

A corrections officer was alerted by an inmate that Gomm needed help and saw Johnson striking his colleague in the head with a hammer. Johnson turned and took a swing at the other officer but missed. The officer, "fearing for his life ... retreated from the shop to a nearby stairwell."

Johnson barricaded the door shut and started running around the shop shirtless, telling other inmates, "You guys are fine."

Responding officers arrived, and Johnson surrendered with his hands up.

Officers told investigators that inmates often strip off their shirts when "they are involved in a fight or other aggressive or assaultive conduct," the charges read.

Johnson checked out the hammer when he reported for work in the building, and two homemade knives were recovered. Authorities believe one or both of them were used on Gomm.

Johnson was to have been released from prison in late 2022 and then serve the balance of his sentence for the 2002 murder on supervised release. However, a conviction for Gomm's death could keep him behind bars for the rest of his life.

Johnson has a long history of violence. At the time of Gomm's death, he was serving a 29-year term for fatally stabbing his 22-year-old roommate, Brooke Thompson, while her 5-year-old daughter was nearby in their Bloomington home in 2002.

Late that year, while in the Hennepin County jail during his trial, Johnson assaulted a deputy. He ignored orders to stay out of a certain area of the jail and punched the deputy in the eye, leaving him with a cut, according to the charges. He pleaded guilty to fourth-degree assault and was given a 10-month term.

His violent tendencies persisted in prison. He has racked up at least 1,695 days in segregation for numerous offenses, including 540 days in connection with a prison fight in July 2004, authorities said. During that fight, he was stabbed in the right eye by a fellow inmate with whom he'd had a long-running dispute. The attack cost Johnson his eye.

Johnson was most recently sentenced to segregation in June 2016. Since then, he had demonstrated "relatively good behavior" and had been allowed to work in the prison industrial building, said DOC Commissioner Tom Roy.

One day before Johnson was charged, union leaders representing corrections staff called for more prison officers and changes to inmate discipline rules. AFSCME Council 5 has long complained that facilities are understaffed and officers are not properly equipped.

At least three officers have resigned following Gomm's death, and many more have taken leaves of absence as of last week, the DOC said.

DOC spokeswoman Sarah Fitzgerald said a review indicates the need for 150 additional officers at state prisons and the agency backs the union's push for more money from the Legislature.

An Associated Press analysis of DOC data show there were 186 inmate assaults on employees in the most recent fiscal year, up from 114 from the previous fiscal year. Assaults that caused harm jumped from 12 to 30, and assaults with weapons that caused harm rose from one to seven.

Gomm, 45, of Blaine, is believed to be the first Minnesota corrections officer to die in the line of duty, and his funeral last week drew thousands of law enforcement officers from around the nation.

The Associated Press contributed to this report. Paul Walsh • 612-673-4482