A man who was a lifeboat crew member when he made 19 hoax coastguard calls has avoided jail.
Leon Marandola, 20, was a volunteer with the Buckie RNLI crew in Moray when the incidents happened between June and August in 2019.
He had hoped the calls would help him gain experience - but he was never selected to go on the callouts.
Marandola was ordered to carry out unpaid work as a direct alternative to custody at Elgin Sheriff Court.
Sheriff Olga Pasportnikov said he had shown "utter stupidity".
Defence lawyer Matthew O'Neill said Marandola was "deeply remorseful".
He had earlier admitted repeatedly breaching the Communications Act by knowingly providing false information.
Marandola admitted sending messages he knew to be false through VHF radio and 999 calls, and indirectly through posting on Facebook, for the purpose of causing "annoyance, inconvenience or needless anxiety" to the Maritime and Coastguard Agency (MCA).
He claimed vessels or people needed to be rescued at sea when he knew this was not true.
Specialist equipment was used to capture Marandola's transmissions and to analyse data to work out the area where the calls were made.
The hoax callouts over a two-month period are estimated to have cost about £170,000.
Marandola will have to perform 240 hours of unpaid work. He will also be under supervision for two years and a restriction of liberty order has been imposed.
Mr O'Neill said Marandola had started to volunteer for the RNLI in his home town of Buckie.
However, he began to feel "adrift" from others at the station and because of his lack of experience was worried he would not be of use.
Mr O'Neill said the method he unfortunately chose in a bid to address that was claiming boats were in distress so the lifeboat would be called out, hopefully with him on it.
But the lawyer told the court: "He was never picked to go out for an active rescue."
Mr O'Neill said the circumstances were perhaps the most perplexing he had ever come across.
He said Marandola was "deeply remorseful", realised the potential risks he had posed, and added: "He realises his actions were beyond foolish."
He said Marandola revelled in community work and had otherwise never been in any trouble.
Sheriff Pasportnikov described Marandola's actions as "calculated and devious".
She said the 19 hoaxes led to 10 actual callout responses.
"You put lives at risk", she said, highlighting volunteers and also anyone genuinely needing help.
On one occasion, a rescue helicopter had to be requested while dealing with an incident in Stornoway.
She said he tried to cover his tracks but eventually realised the game was up.
The sheriff accepted Marandola had previously been of good character, otherwise he would have been facing custody.
She said she was satisfied his actions did not arise out of malice, but naivety.
The RNLI said it was "disappointed" the calls were made by a person previously connected to one of its lifeboat stations.
HM Coastguard coastal operations area commander Ross Greenhill said: "This case stands out because the offender is someone who wanted to work alongside emergency services to help people and prevent loss of life at sea.
"Each time he made a false report, he put the safety of his fellow volunteers at the RNLI and HM Coastguard at risk and let down his local community."
Police Scotland said its "complex inquiry" involved working with telecommunications regulator Ofcom, adding that Marandola's series of hoax calls caused considerable expense and put staff and volunteers at "unnecessary risk".