A 10-year-old girl with epilepsy was forced to sleep in a dog cage because a council refused to provide a special bed.
Mum Effie Fenton Hunt said the drastic action was the only way she could keep her daughter, Sadie, safe.
Sadie has a rare form of epilepsy and can't be allowed out of bed at night in case she hurts herself.
But Edinburgh Council said they wouldn't supply the special padded cot she needed because her case didn't meet its 'funding criteria'.
Effie told the Daily Record: "The dog pen was basically a metal cage with mesh panels which you link together. It was horrible to see my daughter in a dog cage but we didn't have any choice."
The 41-year-old mum added: "Sadie has West syndrome. She has little understanding of the world. Her frustration at being unable to express herself affects how she behaves. She bangs her head against walls and things.
"Sadie doesn't sleep well and can be awake a lot during the night. She needs a bed where she can't get out.
"Special beds are essential for someone with needs like Sadie. It's so difficult caring for her and doing that without sleep makes it so much harder."
In desperation, Effie contacted Newlife Foundation for Disabled Children, which stepped in with an emergency loan of a specialist bed to meet Sadie's needs. She then set up a JustGiving page to try to raise the nearly £5,000 needed to buy the equipment outright.
But then there was a happy twist – because after local media coverage of the family's story, Edinburgh council decided to review its funding criteria and is now going to pay for Sadie's new bed.
Effie wrote on JustGiving: "I'm thrilled to say that following today's media coverage, Edinburgh council have decided to review their funding criteria and are going to fund her bed! I'm working with New Life on the use of these valuable funds you have all raised, thank you so much!! :-) :-)"
Any money raised from Sadie's story will be used to fund equipment for other disabled and terminally ill children in Edinburgh.