A teenager who fatally stabbed a "vulnerable" friend to steal money for cannabis and food has been jailed for a minimum of 17 years.
Michael Deary, 29, was found dead from five stab wounds at his flat in Fareham, Hampshire, on 20 August.
Luke Pearce, 17, from Gosport, pleaded guilty to murder at a previous hearing at Winchester Crown Court.
The judge said it was a "brutal, violent and sustained attack" on a man who "suffered from mental ill health".
Police broke into Mr Deary's flat in Omaha Close and found him lying dead on the floor in his underwear, covered with pieces of paper and a headboard from the bed, the court heard.
Matthew Jewell QC, prosecuting, said Mr Deary had died after a "significant period of time" as a result of blood loss and a punctured lung.
Blood stains on the walls and floor suggested a "sustained assault in different areas of the flat", he said.
Mr Deary had visited a cashpoint with Pearce in the early hours of 16 August, withdrawing £340, the court was told.
Shortly afterwards Pearce made internet searches on his phone, including "how to knock someone out safely" and "how long can someone remain unconscious before dying", Mr Jewell said.
He added the murder was probably committed two hours before Pearce left the flat at about 07:15 BST.
After his arrest, Pearce told his mother he had not intended to kill Mr Deary, who had given him a place to stay, the court heard.
In a recorded phone call, he told her: "This is what happens when you've got no-one. You do stupid things because you feel you've got nothing to lose."
Mr Jewell said Mr Deary was a "vulnerable character who others took advantage of".
Mr Justice Goose told Pearce: "This was a murder for gain... because you were short of money.
"He suffered considerably and moved about bleeding profusely.
"You ran a bath to wash yourself and left the deceased knowing he had died."
In victim statements read out in court, Mr Deary's mother, brother and sister said he was "caring and loving" and was "battling his demons".