Scotland's record number of Covid cases is partly being fuelled by the return of schools after the summer holidays, the deputy first minister has said.
John Swinney said the data showed that high numbers of young people had tested positive in recent days.
And he said the case for secondary pupils continuing to wear facemasks in school was growing "ever stronger".
A total of 5,021 new cases of the virus were reported on Wednesday, a record high for the second day running.
That was up from 4,323 in the previous 24 hours - although the rate of positive results being returned was down from 14.5% to 11%.
Tuesday's figure had led First Minister Nicola Sturgeon to warn that the country was at another "fragile and pivotal moment" in the pandemic.
Ms Sturgeon said she could not rule out the possibility of some Covid restrictions being reintroduced - although the levels of serious illness remain relatively low at this stage.
About a third of the new cases were in the under-19s age group - with almost 42% of 16 and 17 year olds having had their first dose of a vaccine.
Speaking to the BBC's Good Morning Scotland programme, Mr Swinney said there was no doubt that pupils and staff returning to school over the past fortnight had contributed to the "unprecedented" number of cases.
He added: "Cases have risen very significantly within Scotland and we are looking closely at why that is the case.
"Undoubtedly the gathering of people together in schools will have fuelled that to some extent, and you can see that in the proportion of younger people who are testing positive."
Mr Swinney stressed that the government wanted to avoid school closures "at all possible costs", with the priority being to ensure that children's education was not disrupted any more than it had already been.
He said: "A few weeks ago we were being criticised for insisting on the retention of face coverings within secondary schools - people were telling us we shouldn't do that.
"But of course, the justification for it appears to me to be ever stronger because of the need to try to avoid the circulation of the virus within the school environment."
Secondary pupils must wear face coverings at all times when they are in school - including while sitting at their desk - for at least the first six weeks of term.
But Education Secretary Shirley-Anne Somerville told the BBC last week that the requirement would be dropped earlier if possible.
She said the government was "erring on the side of caution" by keeping the rule in place after the summer holidays despite most other Covid restrictions being lifted.
The number of Covid cases in schools is released weekly, usually on a Friday.
It goes into detail of the age groups affected, the test positivity rate and how many young people are isolating. For context, just before schools stopped for the summer, there more than 900 cases and almost 29,000 isolating because they were a contact.
We should get the first report of this term at the end of the week. It will be worth looking out for just how many of these new cases are in school pupils. I expect we'll see a big drop in the number isolating, compared to last term, when there were more strict rules in place.
The latest figures from National Records of Scotland showed that Covid was mentioned on the death certificates of 41 people over the past week - the same total as the previous week.
Of these, 12 deaths were of people aged under 65, six were people aged between 65-74 and there were 23 deaths of people aged 75 or over.
The majority - 28 - were male, with 13 female, while 20 of the country's 32 council areas recorded at least one Covid-related death.
Mr Swinney said acute illness remained relatively low in Scotland despite the country recording the highest number of cases it has ever seen, with the pressure on the NHS not as great as it was in other stages of the pandemic.
He said there were no plans to cancel large-scale events such as football matches and concerts "at this moment".
Good hand and cough hygiene
And he said the government had to ensure that any new restrictions were proportionate based on the pressure the NHS was under, adding: "that's the key assessment that ministers have to make".
He added: "In terms of fulfilling our legal obligations to apply any restrictions to the freedoms that individuals enjoy, we have to be able to be satisfied there is a proportionate danger and risk in having to act in that fashion".
Mr Swinney also said the focus for now would be on attempting to ensure people followed the "baseline measures" such as wearing face coverings in shops and on public transport, trying to socially distance where possible and following good hand and cough hygiene.
He said that doing so would help to limit the circulation of the virus and avoid any further restrictions having to be applied in the future.