A boyfriend who discovered another man was at the home of his "on-off" girlfriend went to confront him and was stabbed to death, a court heard.
David Molloy, 24, died after being stabbed in Hemel Hempstead just after 02:20 GMT on 13 March.
Luton Crown Court heard Mr Molloy was "very unhappy" with the presence of Mohammed Khalid at the property and had planned to have "words with him".
Mr Khalid, 27, from Luton, denies murder.
Prosecuting, Simon Wilshere told the jury Mr Molloy had been in a relationship with Karen Payne for about three years but was splitting his time between her home and his parents.
The court heard a 17-year-old messaged Mr Molloy on Facebook about Mr Khalid, who the prosecution allege "was concerned in the supply of drugs" and for that reason he had a "large knife" on him.
Mr Wilshere said: "You will see from text messages that [Mr Molloy] was sending to the [17-year-old] that he was very unhappy with the presence of Mr Khalid at Saturn Way and was intending to have words with him when he got there."
The court heard Mr Molloy arrived at the property in Saturn Way at about 02:10 and the daughter, who had been thrown outside for contacting Mr Molloy, could see a "commotion" in the living room through a window.
The jury heard a knife wound to the chest "penetrated" Mr Molloy's heart.
Mr Khalid was arrested two days later near the Pakistani Embassy where he was trying to get a travel document to leave the UK, the jury heard.
Emma Payne, 41 of Eight Acres in Tring, Matthew Eyles, 44, of no fixed address, and Paul Smith, 48, of Hosking Court, Maylands Avenue, Hemel Hempstead all deny assisting an offender.
Mr Smith denies a further charge of doing an act tending or intended to pervert the course of public justice by later providing a false witness statement to the police who were investigating the death of Mr Molloy.
The trial continues.