Image copyright PA Image caption A replacement Higher English paper had to be compiled and issued weeks before the exam

A teacher who allegedly told students what to expect in the Higher English exam sparked a near-emergency at the exams agency, BBC Scotland can reveal.

One of the Higher English papers was replaced weeks before the exam amid concerns it may have been leaked.

A teacher involved in setting the paper may have given their students too much information, BBC Scotland understands.

The Scottish Qualifications Authority (SQA) said it was carrying out a full investigation.

It compiled a replacement paper as a precaution.

The replacement was sent to schools and exam centres a week before the exam earlier this month. It was compiled much more quickly than usual to meet the urgent deadline.

The SQA gave little information about the specific circumstances which led to the emergency.

The exams body said "unusual" and external" circumstances were to blame.

Image copyright Getty Images Image caption It is the thought the investigation centres on a teacher who played a part in setting the original paper

But BBC Scotland understands the focus is on a teacher who played a part in setting the original paper.

It is alleged the teacher suggested to students what topics might come up in the exam and the kind of answers they could give.

The concern was these students could have been unfairly advantaged or may have spread the information - either personally or on social media.

A spokesperson for SQA said: "We are continuing to conduct a detailed review of the circumstances around this year's Higher English examination and it would be inappropriate to comment further until that process has been completed."

There is no suggestion that any member of SQA staff, nor any external contractor such as the printers, acted irresponsibly.

Nor is there any suggestion that anybody at either the school concerned, or any other school, who had responsibility for looking after the exam papers, was in the wrong.

Secure storage

The issue was a concern that the content of the exam - as opposed to the paper itself - could have become known to candidates.

BBC Scotland revealed two days before the exam a replacement for one of the two papers had been sent out the week before.

The problem had come to the SQA's attention a few weeks earlier. Although the new paper had to be compiled quickly, the organisation said it always produces more material than is actually needed.

Generally, one person at each school or exam centre takes responsibility for all the exam papers and makes sure they are safely and securely stored until they are needed.

Teachers do not get to see exams beforehand.