A record number of Scottish pupils have achieved a university place on exam results day.

So far 28,700 Scottish pupils have been accepted into higher education, a 1% rise from last year.

Admissions body UCAS advised those who did not receive the results they wanted that there were still university places available through the clearing process.

Figures showed a 13% increase in the number of pupils from deprived areas being accepted into university, according to UCAS.

Just under 137,000 pupils were given their results by text, email or post on Tuesday.

Of the 28,700 to achieve places at universities, 27,830 were placed at a Scottish institution.

Clare Marchant, chief executive of UCAS, said: "Well done to all those students who have worked so hard to get their results and secure their place at university or college.

"If you have not done as well as you had hoped, try not to worry. Take some time to think about what you want to do next and seek advice from those who know you best - parents, teachers, and friends.

"You have plenty of options."

She added: "If you decide you still want to start a degree this year there will be around 40,000 courses in the UK with clearing vacancies.

"Last year, 1770 students from Scotland secured their place in higher education through clearing."

Some 4150 pupils from the most deprived areas received a higher education place on Tuesday, an increase of 470 or 13%.

Those in the areas considered to be the most deprived represented 14.4% of all applicants who achieved a university place.

The SQA said the pass rate for Higher exams remained largely steady from the previous year.

Candidates passed 150,010 Highers, with an attainment rate (grades between A and C) of 77%, down slightly from 152,701 passes with a rate of 77.2% last year.

Dr Janet Brown, chief executive of the SQA, said: "I think it shows a very stable system.

"One of the things that we absolutely have to ensure is that standards are maintained and we can see that candidates are reaching those standards and attaining as they have done in the past."

In maths, the attainment rate rose to 74% from 73.5% last year at Higher, while in English the attainment rate dropped from 78.8% in 2016 to 77.3% this year.

Pass marks were around 50% with no repeat of the problems with the 2015 maths exam.

Dr Brown said: "Everything has worked as we would expect and our systems have worked as we wanted them to, to ensure candidates achieve what they deserve and allows them to go to the next phase of their lives."

As the results came in on Tuesday, three sets of twins from the same school found out they had achieved straight As in their Highers.

Emma and Vivien McAinsh, 17, Joseph and Michael Lowrie, 17, and Niamh and Roisin Kelly, 16, all attend St Ninian's in East Renfrewshire.

All together they notched up 30 top grades, with sibling rivalry playing a part in some of their success.

Roisin Kelly said: "I would not have worked as hard if she (Niamh) hadn't forced me to, so it actually came in handy."