A mallet-wielding violent offender went on the rampage at a courthouse smashing windows throughout the building.

Courtrooms had to be locked and extra police rushed to the scene at Dunfermline Sheriff Court.

Boguslaw Lach, 35, did not have a court appearance on Wednesday (May 8) but turned up there anyway armed with a mallet.

He smashed glass doors at the entrance, a window to the police office before going inside and vandalising more glass panes in the main corridor.

The incident occurred at around 12.30pm when the court was in operation.

Dunfermline Press: Lach, who admitted causing the damage with a mallet, was granted bail and will appear for sentencing at a later date.Lach, who admitted causing the damage with a mallet, was granted bail and will appear for sentencing at a later date. (Image: Contributed)

A frightened woman, who had witnessed the incident, ran into a courtroom and told staff that someone was in the building smashing the place up with a hammer.

When Lach, of Inchkeith Drive, Dunfermline, appeared in the dock a little more than 24 hours later, accompanied by a Polish translator, he was granted bail.

He admitted that on May 8, at Dunfermline Sheriff Court, Carnegie Drive, he conducted himself in a disorderly manner, smashed windows and glass panels with a mallet and committed a breach of the peace.

Defence solicitor Shona Westwood said her client had been on a community treatment order since 2016 because of significant mental health issues.

Sheriff Clair McClachan did not ask to hear the Crown narration of the facts before she decided to call for reports and to grant bail.

She called for a psychiatric assessment and Lach will be sentenced on July 3.

The Crown had asked for a special condition to ban Lach from the court building apart from to attend his hearings but the sheriff decided not to impose this.

In 2016, Lach was put on a community treatment order, which is still in place, for violently attacking nursing staff at Dunfermline’s Queen Margaret Hospital.

One worker had his nose burst and a staff nurse was kicked in the head during the incident after Lach had been taken to the hospital by the police.