text: Jordan McNab, 21, and two others entered 48-year-old Ian Dickson's flat in East Kilbride on 20 November 2014.
  Following a prolonged attack, the victim suffered facial bruising, a collapsed lung and a fractured rib and would have died without medical help.
  McNab admitted a charge of assault to severe injury and danger of life. He faces jail when sentenced later.
  The High Court in Glasgow heard that McNab, along with two others, entered Mr Dickson's home through an unsecured window.
  Mr Dickson was punched, kicked and hit with a baseball bat and a piece of wood over a period of 20 to 30 minutes.
  Neighbours who heard a disturbance called the police shortly after 02:00.
  When officers arrived they found both back windows ajar and Mr Dickson lying injured on the floor in the back bedroom.
  The entire flat appeared to have been ransacked.
  Mr Dickson was given first aid and taken by ambulance to the South Lanarkshire town's Hairmyres Hospital.
  When police searched the flat they found a wallet containing bank cards and identification in the name of Jordan McNab.
  McNab, from East Kilbride, was later detained and found to have Mr Dickson's blood on his clothing.
  He was originally charged with attempted murder but has his guilty plea to the lesser charge accepted.
  The motive for the break-in and attack is still not known.
  Judge John Morris deferred sentence on McNab until next month.
target: A man who broke into a flat and brutally beat the householder was caught after he left his wallet behind.