Fraser Smith, 23, from Haddington, was caught taking pot shots at Cockenzie Power Station with the weapon he had bought for £10 after being seen by security staff watching CCTV.
He was spotted with three others firing missiles at a conveyor belt on the plant that connects the power station to the neighbouring coal facility on July 26.
Police swooped and detained Smith a short time later, Haddington Sheriff Court heard.
Depute procurator fiscal Sarah O’Gallagher said Smith was discharging the crossbow in an area widely used by the public and that the conveyor belt was used by maintenance crews at the power station.
She added: “Witnesses were working at the [plant] when they became aware of a vehicle on the CCTV monitor. The witnesses observed the accused firing what seemed to be a crossbow.
“They could see from the CCTV an item similar to an arrow protruding from the side of the conveyor and they contacted the police.”
Smith admitted to conducting himself in a disorderly manner by repeatedly firing bolts from a crossbow and committing a breach of the peace.
Solicitor Andrew Mellor said his client had trouble with “consequential thinking” and that he had blamed the wind for his wayward shooting.
Smith had his sentence deferred for the crossbow offences but was jailed for two unprovoked assaults when he appeared in the dock on Wednesday.
The court was told Smith had earlier pled guilty to the assaults which took place at a bistro in Haddington on April 1.
Sheriff Peter Braid said: “The assaults were unprovoked and, taking into account your record, the appropriate sentence is a custodial sentence.”
Smith received a six-month prison jail term for the assaults but Sheriff Braid said he would defer sentence for the crossbow offences until after he was released from prison.