Loffley then left the house with his brother Gabriel, who also lived there. They stopped at a number of shops before returning. Ms Lawrence was watching a DVD in her bedroom, next to JJ's.
Loffley then "discovered" JJ was not breathing.
The little boy was taken downstairs and laid on the lounge floor. An electrician contracted by Housing New Zealand to replace smoke alarm batteries arrived soon after and performed CPR on JJ.
Paramedics arrived within minutes but JJ was dead - his heart was not functioning and there were no vital signs.
Loffley allegedly told police JJ had fallen off his mother's bed and hit his head. But a post mortem revealed the extent of JJ's horrific internal injuries, and determined that was what killed him.
Police arrested Loffley on December 13 and charged him with JJ's murder.
Loffley says police "got the wrong person".
Defence lawyer Roger Chambers told a jury in an opening address in the High Court at Auckland this afternoon that Joel Loffley denied hurting JJ on the day he died.
Loffley acknowledged he had been violent towards other people in the past, but vehemently denied assaulting JJ, Mr Chambers said.
JJ's biological father, who is serving time at Paremoremo Prison for burglary, money laundering and escaping, was the first witness called to give evidence by the Crown on day one of Loffley's trial.
Ruhe said he tried repeatedly to get hold of JJ over the weekend before he was killed, because he was worried about him. In the weeks leading to JJ's death he been struggling to get hold of Ms Lawrence - which was the usual way of contacting his son.
He was so concerned that he asked his sister to go to the house and check on JJ. He told the court that he had been told JJ was being abused and that Loffley was a "shady character and not to be trusted".
The day after JJ died prison managers and the chaplain gave him the terrible news his son had died.
He then rang Ms Lawrence, who told him JJ died after falling from the bed and hitting his head. He had, she said, gone to sleep afterwards and not woken up.
Ruhe told the court that Ms Lawrence had been a loving mother who always made JJ her "number one priority".
Electrician Roger Lang also gave evidence this afternoon. He was contracted by Housing New Zealand to go to the house and replace a smoke alarm battery the day JJ died.
Soon after he arrived Loffley's brother Gabriel told him someone inside the house was not breathing. He offered to help and was taken into the lounge, where JJ was lying on the floor.
Mr Lang broke down briefly when he recalled the moment he realised JJ was dead. He said he tried everything he could to save the little boy and wished he could have done more.
"I had no reason to suspect that anything untoward had happened to the child. As far as I was concerned I had walked into a situation where a child had had an accident," he said.
Neighbour Te Pokura Titoko said he heard Loffley and Ms Lawrence arguing and screaming coming from JJ's house the morning he died. They were swearing at each other profusely. He left the house with his aunt to go shopping and visit a relative in hospital.
They returned a few hours later and had just finished watching a movie when the arguing started again next door.
He heard a woman yell: "What did you do?" and a male responded "I don't know what happened". The woman screamed "I hate you, I hate you" and started crying.
An ambulance and police cars arrived minutes later.
The trial is set to continue for three weeks.