A man has been charged with allegedly exposing himself and performing a solo sex act inside the University of Glasgow.

Police officers were called to the campus library after staff raised the alarm on Sunday afternoon.

The suspect is now set to appear in court.

A Police Scotland spokesperson said: “A 26-year-old man was arrested and charged following a report of someone performing an indecent act on themselves at a premises on Hillhead Street in Glasgow on October 20."

(Image: supplied) One source told the Glasgow Times that the alleged incident had shocked staff and students.

They said: “I saw four officers enter the building. People were understandably upset and surprised to see officers on the campus in the first place, but even more so given what is alleged to have taken place."

READ MORE:Update on Glasgow container that turned into massive rats' nest

A Glasgow University spokesperson said: “We can confirm police were called to address an alleged incident on university premises.

“The safety and security of our staff and students is always our number one priority.

“It is rare for members of staff to call the police to anything on campus, however sometimes it is necessary to alert the authorities for the safety of those in our community, or for the wellbeing of those involved in an incident.”

The man is due to appear at Glasgow Sheriff Court.