At the schools he led, Michael Mavor is remembered for his oratorical ability, his attention to detail and his dedication to high academic standards.
Among his former pupils at Rugby, Gordonstoun and Loretto schools, however, he is best remembered for skateboarding in assembly, hitting a golf ball into the chapel organ and claiming that Maltesers could cure all ills.
Michael Barclay Mavor was born in the British colony of Malaya in 1947. His parents moved to Edinburgh when he was three years old, and sent their son to nearby Loretto School. There, displaying a breadth of talent that would stay with him all his life, he was appointed head boy, captain of the cricket, hockey and golf teams, member of the rugby and tennis teams and editor of the school magazine.
After school, he studied English at St John's College, Cambridge. It was here that he met Elizabeth, the woman who would become his wife; together, they had two children, Alexander and Veronica.
On graduating, he took up a three-year teaching fellowship at Northwestern University, in Illinois. Returning to Britain in 1972, he taught English at Tonbridge School, in Kent. Once again demonstrating a talent for extracurricular hyperactivity, he also coached rugby and cricket, edited the school magazine, produced plays and organised the general studies course.
He was only 31 when the headship of Gordonstoun became vacant. The governors who interviewed him described his CV as "too good to be true": surely, they thought, there must be a catch. But there was none, and the youthful Mr Mavor took leadership of the school in 1979. His new pupils included Prince Andrew and Prince Edward.
His first priority was to raise the school's slipping academic standards. "I don't think," he told parents on his first speech day, "that boys and girls work hard enough here." By the time he left, 11 years later, they were working significantly harder.
But the school's famous outward-bound culture also appealed: he coached the rugby first XV, and spent early mornings salmon fishing on nearby rivers.
It was his attention to the day-to-day detail of school life, however, that most impressed staff and pupils. He knew every pupil by name, greeting them personally at the start of chapel services. On one occasion, he caught a final-year pupil reading a Jilly Cooper novel during chapel. Three months later, at the end of the school year, Mr Mavor presented the pupil with a copy of Jilly Cooper's latest book.
In 1990, he was appointed head of Rugby School. The Warwickshire boarding school's reputation was in decline, and Mr Mavor tackled this by moving to a fully co-educational intake. He also oversaw a complete refurbishment of boarding houses for both sexes.
At Rugby, too, he established a reputation for attention to detail: he proofread every letter and document that was sent to parents. And he was noted for his ability to speak, as well as write, in grammatically perfect English. Always an engaging speaker, he regularly used props - a remote-controlled car, a fishing rod or a cricket bat - to help convey his message. On one occasion, he skateboarded down the aisle during a chapel service.
In 1997, he was elected chairman of the Headmasters' and Headmistresses' Conference of independent schools.
Mr Mavor was always a proud Scot: he regularly played the bagpipes as Rugby pupils marched into chapel. So in 2000 he returned to his hometown of Edinburgh, taking up the headship of his alma mater, Loretto School.
Deciding that the school needed something to distinguish it from its rivals, he established Loretto as one of the first British golf academies, offering intensive tuition to promising young players.
Here, too, he displayed his talent for unconventionality: pupils recall their headteacher driving a plastic golf ball from the chapel altar into the organ loft. Others remember being told that the secret of creativity was to bang one's head against the table three times. And Mr Mavor regularly presented injured or troubled pupils with bags of Maltesers: "the best medication".
He retired in 2008, and was visiting family in Peru when he died suddenly of a heart attack on December 8. He was 62 years old.
Michael Mavor is survived by his wife and two children.