An arsonist who torched four buildings and caused almost £20 million of damage during a psychotic episode has been sectioned indefinitely at a mental health unit.
Farmer Andrew Main, 47, set fire to South Oxfordshire District Council's office, a thatched cottage, an undertaker's and his own home earlier this year.
Nearly 200 firefighters from four counties were required to contain the fires in the early hours of January 15.
One fire burned for almost three days, destroying 85% of the council building and forcing hundreds of employees to relocate.
Several council departments, including planning services, were left completely gutted and substantial amounts of computer data lost - with damage estimated to be around £20 million.
Prosecutor Michael Roques told Oxford Crown Court it was "miraculous" no-one was killed.
Two psychiatric assessments concluded Main was "acutely unwell" when he started the fires and, following a guilty plea to four counts of arson, he was detained under section 37 of the Mental Health Act.
Sentencing, Judge Ian Pringle said: "It is clear at the time in question, in December and January of this year, that you had a deeply psychotic relapse of bi-polar disorder.
"Three hundred and fifty council employees being relocated was catastrophic for them and all the county council.
"We will never know why you picked on the targets you did, but we will always know that the consequences were utterly, utterly devastating."
The first fire was started at around 3am, when Main's 80-year-old neighbour Jean Gladstone had the thatched roof of her cottage at Quakers Corner in Rokemarsh set alight.
Within minutes, both Howard Chadwick Funeral Service in nearby Crowmarsh Gifford and the council offices were engulfed in flames.
Mr Chadwick had previously arranged the funeral of Main's mother, to whom it was said he was "very much devoted", and her death in December 2013 was cited as the start of his psychological decline.
All four fires were started using gas canisters which were ignited by matches.
The court heard Main, of Rokemarsh near Wallingford, intended to commit suicide following the arson spree but instead presented himself to police at around 9.45am, saying: "I think you're looking for me."
After starting the fires, Main, who was a professional sheep shearer, told a psychiatrist he had planned to kill himself with a chainsaw in a nearby field, but inadvertently dropped it in a brook.
He admitted starting the four fires and will be detained indefinitely under the Mental Health Act with a section 41 restriction which means he will only be released with the permission of the Home Secretary.
Detective Inspector Louise Tompkins, of Thames Valley Police, said: "Main's guilty pleas have saved a number of witnesses the anguish of having to give evidence at court.
"I hope his convictions bring some sort of closure to all those affected by the incident.
"The hospital order reflects how unwell Mr Main was at the time he committed the offence."