A man beat his partner to death then texted a colleague to say he would not be in work the next day because of what he had done, a jury has heard.
Brian Buckley, 41, sent texts to Martin Rhys Jones, who then went to his colleague's Wrexham home and found the body of Leah Ingham, 25, on 7 February.
Warehouse worker Mr Buckley, who denies murder, had learned that she was going to leave him, Mold Crown Court heard.
It is claimed he texted: "I'm goin jail n e way mate" and "Just killed Leah".
Prosecutor Simon Medland told the court that on the night of Ms Ingham's death the couple had argued about drugs and also a new relationship which Ms Ingham was beginning with a man named Timothy Davies.
Prior to the attack Ms Ingham and her children had been to her mother Heather Harvey's house for Sunday lunch before being dropped off back at home at about 1945 GMT, he said.
"As Heather Harvey watched Leah and the kids walking into the house where the defendant was, it was, sadly, the last time that she was to see her daughter alive," said Mr Medland.
After the children were put to bed the pair argued, it became violent and furniture was knocked over, he said.
"The defendant pressed home his attack and although it is plain that Leah tried her best to fight him off, she was no match for him."
At 22.5, Mr Buckley sent a text message to Mr Jones, a colleague at TDG, a warehousing company in Wrexham, saying he would not be in the next morning.
"I'm goin jail n e way mate," he texted.
About 10 minutes later he sent another saying "just killed Leah."
Worried, Mr Jones went to the couple's home to find what had gone on and found Ms Ingham dead.
Mr Buckley swore, saying: "I told you I'd done it."
He told Mr Jones that he had done it because she was seeing someone else and taking heroin, the trial was told.
The jury heard that both Mr Buckley and Ms Ingham had a problem with drugs.
Ms Ingham was a former army paramedic who later worked in a jewellery shop.
She had managed to keep clean of heroin for long periods, relapsing occasionally, but that had not stopped her bringing up her children well and working hard, said Mr Medland.
After discovering the body, Mr Jones raised the alarm with two of his relatives, the jury heard.
Mr Buckley himself dialled 999, saying: "We had a fight. I think I strangled her. I think it happened about two hours ago."
When police arrived at 0105 GMT, he was arrested and the children taken to safety.
Mr Medland said Mr Buckley had a propensity to use violence against female partners and the prosecution claimed Ms Ingham's "grave injuries" did not occur out of the blue.
"These episodes were often associated with alcohol and drugs, particularly heroin," he said.
The trial, before Judge Merfyn Hughes QC, is continuing.