A teenager who waved a kitchen knife around outside a High Wycombe pizza parlour was spared jail after his lawyer claimed diners were "content" to sit with him when he sheathed his blade and came into the restaurant.

Tyrell James had stood in the doorway of Jimmy's Pizza in Brindley Avenue and brandished a 10-inch knife at a group of three other men, who were all holding machetes on November 21 last year, a court heard.

The 19-year-old had shouted at the three and poked his blade in their direction, prosecutors said, until they left the scene and James then went into Jimmy's and sat down.

Defending James, who was charged with possessing a bladed article in a public place, his lawyer pointed out that diners at the restaurant had not fled as the defendant entered the restaurant.

Christopher Pembridge, in mitigation, said: "It is worth saying that whilst there were members of the public present, they seemed content actually to stay put in the restaurant with the defendant after the incident.

"Witnesses noted seeing a family there and the defendant. The people with the machetes, they all left. The defendant stayed in the takeaway restaurant until the police arrived."

James, of Hawksmoor Close in High Wycombe, had admitted carrying the blade in police interview, but said he used it for self defence.

He had also been found to have bank cards which he had found on the floor, which he admitted he had intended to use for fraud but he did not have the pin codes.

Appearing before magistrates, James admitted possessing a bladed article and theft by finding. He was committed to Aylesbury Crown Court for sentencing, where he appeared via video link from HMP Bullingdon.

Mr Recorder Simon Taylor QC, sentencing, told the defendant: "Waving a knife around in public, issuing the sorts of threats you did, make the public really scared.

"The problem here is that you are scaring all the members of the public. Carrying knives is a serious offence because it increases the chance that someone is going to get hurt.

"You may think it makes you safer, but it does not, it makes it more likely that someone is going to get hurt."

Sparing James jail, Mr Recorder Taylor said: "You are beginning to understand the seriousness and the potential harm you are making by carrying a knife. There is an opportunity to be seized here to try and help you turn around. You will either turn around or you will not. It seems to me that it would be to the benefit of society if you did."

James was handed an eight-month jail sentence, which was suspended for 18 months. He was ordered to carry out 120 hours of unpaid work and 19 days of a rehabilitation activity requirement.

Although James was in breach of a suspended sentence for a previous conviction of possessing class A drugs, the Recorder said he would impose no separate penalty for that breach.