Brandon Muir died in hospital in Dundee on 16 March last year
The man accused of murdering a 23-month-old boy did not want to look after the child in the hours before he died, a trial has heard.
Darren O'Shea told the High Court in Glasgow that Robert Cunningham resented having to care for Brandon Muir.
The toddler died in Ninewells Hospital in Dundee on 16 March.
Mr Cunningham, 23, denies murdering him. The boy's mother, Heather Boyd, also 23, denies culpable homicide by failing to get him treatment.
Witness Darren O'Shea, the partner of Mr Cunningham's sister, said that both accused and Brandon had been at his Dundee flat the evening before the toddler died.
He said that Brandon had been unwell and that both accused had argued with each other after Ms Boyd went out leaving the toddler in Mr Cunningham's care until 2300.
In a police statement, Mr O'Shea said: "Robert didn't look happy when Heather came back because she had left him with Brandon and he was not well.
"Robert had made it clear when Heather was away that he was not happy at being left with her sick kid."
He added that there was then a "real atmosphere" between both.
Mr Cunningham's QC Ian Duguid asked the 27 year-old: "This was over her leaving him with Brandon?"
He replied: "Yes."
The court also heard that Brandon's eyes were "rolling in his head" the evening before he died.
April Fyffe, 16, who was also at the flat, told the court: "He was beside the toilet lying against the wall.
"He didn't look well. He looked really unwell.
"His eyes were rolling back. Standing there he looked like he wanted to sleep."
Murder and assault
Mr Cunningham is accused of murder by assaulting Brandon so severely last 15 March at two flats in Balunie Crescent that he died the following day in hospital.
Mr Cunningham and Ms Boyd also face a charge of repeatedly and wilfully ill-treating Brandon between October 2007 and March 2008.
Ms Boyd is accused of assaulting her son at Douglas Family Centre in Dundee on 5 March last year.
Mr Cunningham is also charged with repeatedly and wilfully ill-treating another young boy at two properties in Dundee between October 2007 and March 2008.
The pair deny all charges.
The trial, before Judge John Morris QC, continues on Monday.