The headmaster of an independent prep school in Harrow resigned after he was caught including an insulting coded message to a departing teacher in the school newsletter.

Parents last month received a letter from the chairman of governors at Orley Farm School, in South Hill Avenue, announcing headmaster Mark Dunning would not be returning following “a lapse in judgement” in relation to the school’s newsletter.

Mr Dunning had written a farewell message about the imminent retirement of French and English teacher Roger Clark.

At first glance the remarks looked innocent enough but Mr Clark lodged a complaint after spotting a coded message within the text.

Mr Dunning wrote: “It is with mixed feelings that I announce the retirement of Mr Roger Clark at the end of this term.

“We all now know every really great teacher has to finish one day and Mr Clark will do so at the end of this term.”

The first letter of the first six words in the second sentence - a pattern known as an acrostic - spelt out an offensive word.

In his letter to parents dated February 21, chairman of governors Colin Hayfield wrote: “Having discussed the matter with the governors, Mr Dunning felt that he should take responsibility for a lapse in judgement in the content of a Bulletin newsletter last term and he has tendered his resignation. This has been accepted.

“Mr Dunning had been headmaster at the school which charges fees of £13,000 a year, since September 2006.

When asked to comment on Mr Dunning’s resignation, school bursar Tim Brand said: “It is an internal school matter.

“All the appropriate action has been taken and Mr Dunning has chosen to resign and we have nothing further to add.”

The original version of the October 2012 newsletter has been replaced online with a more carefully worded version.

Mr Dunning, who was previously headmaster of the independent Bishopsgate School in Englefield Green, Surrey, and deputy head of Ranby House prep school in Retford, Notts, did not return after half term last week.

The school governors have appointed Mr Timothy Calvey as acting headmaster.