Inset: Joshua Freitag (Connecticut State Police). Background: The Connecticut home where Joshua Freitag allegedly shot and killed a man who was spending the night with Freitag's estranged wife (WFSB/YouTube).

A Connecticut man allegedly showed up at his estranged wife's suburban home at 4 a.m., broke through a rear sliding glass door and then murdered a male guest who was sleeping over.

Joshua Freitag, 33, is accused of shooting 34-year-old Mark Morgan — a person he knew and allegedly disliked — at his wife's residence in Somers on Monday after noticing Morgan's car in her driveway and texting her about it.

The wife told police that Freitag did not like that she was "friendly" with Morgan and became upset when he saw Morgan at her house, according to an arrest warrant obtained by local ABC affiliate WTNH.

She said she initially lied to Freitag about Morgan being there before Freitag informed her that he saw Morgan's car in the driveway.

The woman reportedly told police that after texting with Freitag, she went to sleep on the couch while Morgan slept in an upstairs bedroom. She woke up to the sound of glass breaking and allegedly saw Freitag entering the home through her rear sliding door, which he smashed. Freitag went upstairs to the bedroom Morgan was in and shot him multiple times, according to police.

"Personnel … responded to South Rd in the Town of Somers for a disturbance involving shots fired," a Connecticut State Police press release says. "Upon arrival on scene, troopers were met outside of the residence by Joshua Freitag, who was detained without incident."

The wife explained to police that Freitag "forced entry into the residence and shot a male victim [Morgan] in a second story bedroom," according to the CSP release. "Lifesaving measures were taken on scene; however, the victim was pronounced deceased."

Civil court documents show that Freitag was named in a divorce filing just five days before his alleged shooting attack. According to WTNH, the wife told police that Freitag had not been living in the home and did not have a key; she changed the front door passcode when Freitag moved out.

Freitag's lawyers have argued that since Freitag owns the residence, he can't break into his own home after his wife locks him out.

The wife told police that Freitag and Morgan have an alleged history of disliking each other, and that Freitag questioned her about Morgan staying with her earlier in the day, according to the warrant. The woman was home with her two juvenile children when Freitag allegedly broke in.

Freitag is being held on a $1.5 million bond on charges of murder, home invasion and risk of injury to a child. He is scheduled to appear in court on Sept. 18.