A care home in Wrexham has been fined £66,000 after a resident suffering from dementia fell 15ft (4.5m) through a window and died.
Stanley James Tilston, 79, was found lying injured in a flower bed in June 2008 at the Plas Rhosnesni care home in Cefn Road.
He died four days later in hospital.
The care home company, now known as Care Homes Wrexham Limited, admitted a breach of the Health and Safety at Work Act at Mold Crown Court.
The court was told Mr Tilston did not like being confined to the home and wanted to leave.
It heard restrictors on the windows were not robust enough and Recorder Charles Fox said it was "an accident waiting to happen".
Simon Parrington, prosecuting, said the care home, then owned by Hallmark Health Care, had failed to put Mr Tilston, originally from Chester, in a ground floor room.
He used a coat hanger to work loose chains installed on windows to prevent residents opening them wider than about 10cm (3.9in).
After Mr Tilston fell, the alarm was raised by another resident.
Mr Parrington said that the home specialised in the care of the elderly mentally infirm.
Staff had been monitoring Mr Tilston after a report from his son that he wanted to leave.
Hours before he fell, Mr Tilston had been seen at 04:00 GMT in bed. One window had the chain properly attached but the second had not been checked and was partially covered by a curtain, the court heard.
The care home was fined £66,000 and was ordered to pay costs to the Health and Safety Executive of £43,200.
Patrick Buckley, defending, said Mr Tilston's window had been locked after reports that he wanted to escape, but he added that a handyman who had replaced the broken chain had then left it unlocked.
Mr Buckley said the care home company was investing in new homes in the south of England, and gave health and safety a very high priority.
The court heard that the company was remorseful about what happened to Mr Tilston.
Immediate steps had been taken to correct the situation, and it had co-operated fully with the investigation, the court was told.
After the hearing, Sarah Baldwin-Jones of the HSE homes inspectorate said that the incident was entirely avoidable.
An open verdict was recorded at an inquest into Mr Tilston death.