A man who spat on a sheriff who refused him bail has been jailed for more than two and a half years.
Gordon Rose, 33, assaulted Sheriff Daniel Kelly when the court convened outside of his cell in Glasgow Sheriff Court.
The decision not to bring him into the dock was taken after an earlier incident with another man.
Rose, from Govan, admitted the assault on the sheriff which happened during a hearing on 31 August.
Sheriff Principal Craig Turnbull jailed Rose for two years and eight months.
The court previously heard on the day of the incident, he was held in the cell area of the building and was due to appear from custody for breaching a previously imposed community order..
Procurator fiscal depute Chris Farrell said: "His solicitor advised the sheriff that he could not be moved from the cell area and the custody court sheriff was asked to convene the court at his cell.
"At 4.30pm the sheriff convened the court in the cell area outside Rose's cell."
Rose's lawyer was also there along with the procurator fiscal depute and security officer.
The lower part of the cell shutter was open during the hearing.
Through his lawyer, Rose admitted breaching the community payback order he was on and asked to be released on bail before being sentenced but this was refused.
Mr Farrell added: "At this stage the accused spat at the sheriff and it landed on his face, inside his mouth, on his arm and gown.
"The security officer quickly shut the open latch on the door."
Defence lawyer Ian Brechny said Rose had mental health problems at the time and was in custody after handing himself in.
He said at the time Rose was "anxious and agitated".
The court heard Sheriff Kelly continued the case until 4 September for another sheriff to deal with it and the remand period would only have been four days.
Mr Brechny added: "It was a reaction to not being allowed bail for four days, which there is no rationale behind."
He said Rose is sorry and "considers this disgusting behaviour".