A Minneapolis man pleaded guilty Wednesday to brandishing a knife in an interrogation room last year before he was shot by police.

Marcus Fischer, 19, also pleaded guilty in Hennepin County District Court to first-degree assault for shooting a man in the chest and to a count of possession of a handgun by a prohibited person.

In an agreement with the Washington County Attorney’s Office, he pleaded guilty to two counts of second-­degree assault for pulling a knife on two Minneapolis police officers. Washington County handled that case due to a conflict of interest.

According to court documents and a news release from the Hennepin County Attorney’s Office: Fischer met with a man on Dec. 13 to buy a gun. Fischer pulled out a gun of his own and fired one shot into the man’s chest. The bullet grazed the man’s heart and lodged in his lung; he survived.

Fischer admitted in court Wednesday that he was being questioned by police about the shooting when he brandished the knife.

Fischer first stabbed himself when the investigators left the room. He refused to drop the knife and walked toward the officers with the weapon raised.

“His attorney said, and Fischer agreed, that he had very little memory of what happened in that room, but that after reviewing surveillance and body camera video, Fischer admitted to pulling out a knife,” the Hennepin County attorney’s news release said.

As part of the plea deals, one count of first-degree robbery and two counts of first-degree assault will be dismissed.

Fischer is expected to receive concurrent sentences. He will likely get six years in prison when he is sentenced June 12, authorities said.