A man who opened the doorbell of his home to check if it was empty before a friend left has pleaded guilty to manslaughter and will be sentenced on Tuesday.

Robert D. Hahn, 42, opened the phone at his home on Thursday, triggering a shootout with police that left his friend in a coma for nearly two weeks, officials said.

The shooting killed Hahn’s friend, Daniel Ries, 32, of Chicago, a U.S. Marshal’s official said on Friday.

Hahn, of Rockford, Illinois, had been charged with two counts of first-degree murder and three counts of attempted murder, police said.

He is scheduled to appear in court for sentencing on Monday.

Authorities say Hahn was in the process of opening the door when he got a call from his friend.

He said he was going to use the door to check the mailbox when the call went out, the Cook County sheriff’s office said in a statement.

Hohn opened the front door, which is a locked one, to the front of the home, opened a window and entered the residence.

He shot Ries multiple times, the statement said.

The police officer who responded to the home found the man with a gunshot wound to his head, the sheriff’s statement said, adding that Hahn then “began to yell at his friend that he was taking his own life.”

Police responded and took Hahn into custody, according to the sheriff.

They later found Ries dead in his bedroom, the department said.

A witness told police that he heard Hahn say, “I’m going to take my own life,” but he did not elaborate, police records show.

Hanson was charged with first- and second-degree criminal homicide and attempted murder and faces a mandatory minimum of 15 years in prison.

He also could face a maximum of 50 years if convicted.