A Sydney man accused of murdering a toddler told an inmate he "hit the kid" but the last thing he thought would happen was that she would die, a jury has been told.
Mohammed Khazma, 25, has pleaded not guilty to murdering his ex-girlfriend's two-year-old daughter in December 2016 in the Sydney granny flat the couple had just moved into.
He also denied two counts of assaulting the girl and causing her actual bodily harm by burning her with a cigarette lighter and slamming her head into a wall in the days before she died.
The defence contends the girl's mother caused the injuries and death but blamed her new boyfriend to cover up her guilt.
Giving evidence in the NSW Supreme Court on Tuesday, an inmate spoke of two occasions when Khazma referred to his case including a time when he said "I did it" and "a little baby girl" as he cried and smashed up a cell.
He said on another occasion Khazma said: "The last thing he thought would happen was it would die when he only hit the kid."
Under cross-examination, the inmate agreed he only told police about what Khazma told him after they informed him he was being charged with a new offence.
"You told him you were prepared to give evidence in court if the detective assisted you with the fresh charge," Khazma's barrister, Luke Brasch, suggested.
The inmate agreed and further agreed that his goal was to get a non-custodial sentence for the fresh charge.
"I spoke to a number of people and it was the right thing to do this, to tell what Khazma told me about," he said.
The trial is continuing before Justice Elizabeth Fullerton.