But the 13-year-old did not understand the potential consequences of the fire he started in the hallway of the building, said the director of the youth psychiatric home where he is being cared for.
The fire on Wednesday night in the Eimsbüttel area of Hamburg killed a 33-year-old woman from Pakistan identified only as Nazia and her two children Rahman, seven, and Daniel, six.
A further 27 people were hurt, and 15 people needed hospital treatment for the effects of smoke inhalation.
Detectives examined CCTV footage, which in combination with eyewitness information, led them to the 13-year-old member of the Hamburg fire brigade cadets, police said in a statement on Saturday.
He confessed to sneaking into the house and setting fire to a pram in the hallway.
Professor Michael Schulte-Markwort director of the clinic said in a statement: "The consequences of his actions were not clear to him.”
The Hamburger Morgenpost newspaper reported that Schulte-Markwort's statement continued: “His actions were neither politically nor personally motivated."
“The boy did not know the house or its occupants. He is not one of these arsonists who want to experience a call-out with the fire brigade. His membership of the fire brigade cadets was important to him for a feeling of belonging."
He added it was important to treat the boy so he could continue with his life despite the heavy burden of guilt.