A former soldier has admitted shaking his girlfriend's five-month-old girl, causing her death.
Hayley Davidson died in hospital after being found at a house in Buckhaven, Fife, on 14 February 2016.
Gordon McKay, 38, had originally been charged with the infant's murder but at the High Court in Livingston he pleaded guilty to the lesser charge of culpable homicide.
McKay, who had been left to look after her, will be sentenced next month.
The 38-year-old, who lived a few doors along the road from Hayley and her mother, said he had found the baby cold to the touch on a beanbag in his living room.
He told police he then shook her three or four times in an effort to revive her.
Three days later, Hayley Davidson died from a head injury at the Royal Hospital for Sick Children in Edinburgh.
Judge Lord Uist continued McKay's bail until sentencing to allow him to spend time with his family.
Advocate depute Jane Farquharson, prosecuting, told how Haley's mother Catherine Davidson had developed an "obsessive" relationship with McKay.
She said the pair denied they were taking drugs but forensic tests showed they had smoked cannabis together with Hayley in the room the night before the youngster was fatally injured.
Miss Farquharson said Mrs Davidson left Hayley alone with McKay for an hour on Valentine's Day 2016 to get her two older daughters ready for a planned day out.
'Pale and unresponsive'
The court heard that at 11.19 Mrs Davidson got a text message from McKay saying: "Come quick" and she ran along to his house with her two daughters.
Miss Farquharson said: "Mrs Davidson walked into the living room where she found the accused leaning over her daughter Hayley, administering CPR.
"She describes screaming at her partner: 'What happened?' and he replied: 'Phone an ambulance, she's not breathing,' which she did from his mobile telephone."
She said the call handler instructed McKay on how to perform age-appropriate CPR by placing Hayley on a hard surface.
Paramedics, who arrived within seven minutes, found Mrs Davidson in a distressed state and McKay giving CPR to Hayley, who was "pale, floppy and unresponsive".
Before the ambulance had arrived, Miss Farquharson said, McKay had told his partner that he had left Hayley alone to run a bath.
"When he returned to check on Hayley she had wriggled down the beanbag. He stroked her face and found her unresponsive," she said.
"Mr McKay then described picking Hayley up and giving her a shake."
Previous hospital treatment
In response to police questioning at hospital, Miss Farquharson said he described shaking the baby three or four times by holding her shoulders, and demonstrated what he had done.
She explained: "He described her head as whipping backwards and forwards."
Miss Farquharson revealed that Hayley had previously had hospital treatment for a broken arm on New Year's Day 2016 - three months into McKay's relationship with her mother.
She said: "Gordon McKay took responsibility for what he described as the 'accident' that caused it. His account was deemed consistent with her injury and the clinical team did not view the fracture as suspicious.
"Social services were notified and did not intervene. Fife protocol has now changed as a result of this case.
"Examination of Hayley upon her admission on 14 February 2016 during the time she spent in hospital prior to her death and scrutiny of the various X rays and scans taken at this time, revealed a number of healing fractures over various parts of her body and of different ages."