A man threatened to slit the throats of two schoolchildren when they pushed in front of him in a supermarket queue.
Anthony Peel chased a boy and girl from the Co-Op store in Beeston, Leeds, as the terrified youngsters ran to a house to ask for help.
Leeds Crown Court heard the incident happened on the same day Peel had been turned away from his doctor's surgery despite telling staff he was worried about his mental health.
Anthony Moore, prosecuting, said the incident happened at the store on Town Street at 3.25pm on June 6 this year.
Mr Moore said a 10-year boy was in the queue in front of Peel and he became angry when an 11-year-old girl joined her friend to pay for items.
Peel swore at the victims and told them he was going to slit their throats.
The youngsters paid for their goods and ran from the store.
Peel chased after them as he continued to swear and make threats.
Mr Moore said the children knocked on the door of a house and were allowed in.
Peel stood outside the house and continued to shout threats before leaving.
Police were called and officers stopped Peel on Elland Road.
The prosecutor said he had two 'throwing knives' and a bladed knife in his bag.
Peel, 35, of Cottingley Heights, Cottingley, pleaded guilty to two offences of making threats to kill, two of possession of an offensive weapon in public and one of having a bladed article.
Maryam Ahmed, mitigating, said Peel had suffered a breakdown days before the incident and was admitted to St James's Hospital.
Miss Ahmed said Peel and spoken to psychiatric nurses who arranged for a referral to his GP to have his mental health assessed.
On the day of the offence he had gone to see his doctor but was turned away and told to come back the next day despite telling them that he was worried what he might do.
She said: "It is this that has triggered the offence. He says he was upset and very frustrated and trying to get help but did not get access to the help he needed."
Miss Ahmed said Peel had been in custody for two months since his arrest.
She added: "He is completely horrified by his behaviour and can't understand how he can behave in such a way.
"All he wants to do is apologise to the young children and anyone affected by his behaviour."
Peel was given a 12 month prison sentence, suspended for 18 months, and was ordered to take part in a 30-day rehabilitation programme.
Judge Mushtaq Khokhar said: "Just image the fear you engendered in them when you made the threat to slit their throats.
"All one of them had done was jump the queue.
"Having taken your abusive language seriously they had to take refuge in somebody's house."