Jamie Barton claimed he had the four-inch serrated blade in his trouser pocket to defend himself against further attack.
However, the first offender was the only person injured, Livingston Sheriff Court heard. The 22-year-old cut his finger on the broken knife trying to get it out of his pocket when police arrived.
Yesterday, Barton pled guilty to having a blade in a public place.
He was searched after police were called to Mosside Road in Blackburn, West Lothian, less than an hour after the bells.
Julia McLaren, prosecuting, said police saw Barton put his hand in his back pocket when they approached.
When asked why he had the blade, Barton told officers he “thought stuff was going to happen”.
Raymond McMenamin, defending, said his client had been chased by three or four youths.
Sheriff Graeme Fleming continued the case for social work reports.