A schoolboy caught with Class B drugs at T in the Park has been left without a criminal record after writing a 500-word essay on drugs for a sheriff.

Aaron Bertram, 17, was granted an absolute discharge after being ordered to pen an essay with the title: "The Perils of Drug Misuse for 16 to 21-year-olds in the 21st Century."

Sheriff William Wood initially gave the teenager the unusual project after he admitted having drugs at the music festival last summer.

Yesterday Sheriff Wood told business management hopeful Mr Bertram that he was satisfied with the effort and time he had spent preparing his essay for the court.

"I have given considerable though to your particular circumstances," the sheriff said. "I deferred sentence and asked you to write an essay in the hope it would bring to your attention the dangers of these illicit substances and misusing drugs in any shape or form.

"I hope it has had that effect. You don't have to be on drugs to have fun. In the particular circumstances what I am going to do is grant you an absolute discharge which means you won't have a conviction.

"This is a lifeline for you, because otherwise you would have to disclose this to any potential employer. Don't let me down.

"I don't want to see you back in court. Good luck in the future."

The sheriff had told the sixth year pupil six months earlier: "You are on the cusp of the rest of your life and this was a very stupid thing to have done. It no doubt seemed like a good idea at the time.

"I want you to provide an essay of 500 words, which isn't too long. The title is the Perils of Drugs Misuse for 16 to 21-year-olds in the 21st century.

"I don't want it to be a lecture on the law. I want to know about the impact it has on you and those like you. I hope you do well in your exams in the meantime."

The court was told that Mr Bertram had completed school and was awaiting his exam results to find out if he would be able to take up a business course at college.

Bertram, of Giffnock, admitted two charges of having Ecstasy and Class B Methylethcathinone at T in the Park on July 10 last year.

Fiscal depute Lisa Marshall had told Perth Sheriff Court: "One tablet of the Ecstasy drug was found in his possession with a potential value of ten pounds. There was 0.14 grams of the Class B drug worth about one pound."

Solicitor Paul Ralph, defending, said: "He is 17 and due to leave school in the summer and go on to tertiary education. Now he has given himself a huge headache."

Sheriff Wood said: "A conviction would seem to blight a young man with prospects, particularly given the quantities of the drugs found in his possession.

"In cases such as this, where lives and futures are made considerably more difficult I will take into account the very small quantities found. Nevertheless, possession of a Class A drug is a serious matter.

"I am going to give you an opportunity, at the end of the day, not to have a conviction at all, but you need to demonstrate that this was a one-off. You will come back before me."

The court was told that Mr Bertram, who works part-time as a gym instructor, had been supported by his parents and had been made aware by them of the life consequences of what he had done.

Outside court, Mr Bertram said he was extremely relieved by the sheriff's approach and hoped to get offered a place at Glasgow Caledonian or Napier University in Edinburgh.

He said: "I am really glad he has allowed me to have a second chance. It was a stupid mistake I made."

The Class B drug Bertram was caught with is commonly known as Meow Meow or M-Cat and is known for its stimulant and psychedelic properties, similar to Ecstasy.

Like Ecstasy, it has been implicated in a number of deaths.