A woman chatted online while a neglected toddler, living in squalor, fell out of the window of her home in a block of flats.

Fortunately, the three-year-old survived the fall from the first-storey property at the Broomhead high-rise flats in Dunfermline.

Kelly Debruijn did not realise the girl had fallen until she heard screaming from outside.

Neighbours looked on in horror as the child toppled off the balcony on to the ground below.

Debruijn, 31, of Broomhead Drive, appeared for sentencing at Dunfermline Sheriff Court for child neglect.

She previously admitted that between July 27 and August 12 last year at her home she wilfully neglected a child in her care.

She caused the girl to live in cluttered and unhygienic conditions and in a home with fly infestation. She failed to provide her with clean and adequate bedding and food.

And she left her unsupervised with a first-floor window open, with the child climbing up to the window and falling out on to the ground below.

Debruijn, who was representing herself, previously told the court that there had been social work involvement and the child has now been adopted by another family.

Depute fiscal Isma Mukhtar said a next-door neighbour had become concerned about the smell coming from Debruijn’s flat and the amount of rubbish piling up. There was also an infestation of flies and the neighbour had contacted the council’s housing and social work departments.

A downstairs neighbour was also concerned about the smell coming from the property.

Fife Council also received an anti-social behaviour complaint about noise from the flat.

A Fife Council staff member visited Debruijn’s home on August 3 last year.

“She seemed embarrassed about the visit,” said the depute and the council worker had to swat flies away during the visit.

Debruijn claimed she was suffering from various conditions including PTSD and anxiety.

The kitchen and bathroom were “filthy” and the child was observed “climbing over everything and running around”.

“On August 12, Debruijn was at home with the child and was chatting online,” continued the depute.

Neighbours were walking past the flats at 6.30pm and saw the girl at a window. The child then climbed out and fell on to a stony area below.

The child, who was wearing only a nappy, was picked up and comforted by the neighbours.

Debruijn only became aware of the incident when she heard the child screaming. She then saw the child was not in the flat and that the balcony door was open.

An ambulance was called and the child was taken to hospital. The depute gave no details about the girl’s injuries.

Police arrived and described the flat as being in a state of “extreme squalor”. There was human faeces on a mattress on the floor and the property was “uninhabitable”.

Police saw that the girl could have climbed up on to black bags on the balcony and then fell.

Sheriff Garry Sutherland said what the court had just heard was “quite horrifying”.

“For a three-year-old to be living in these conditions is bordering on unbelievable," he said. "I find it unbelievable you did not seek help.

“If it wasn’t for the difficulties you were going through at the time you would be facing jail today.”

Instead, he imposed a six-month restriction of liberty order.