Despite the support of a vocal student faction on campus, former Breitbart News editor Yiannopoulos took just 533 of 8,210 student votes for the role of rector, according to The Glasgow Guardian.
More than half of the students who voted (4,458 of 8,210) opted for campaigner Anwar to become rector - an honorary role that represents the entire student body - praising him as “principled”, “hard-working” and “loyal”.
“Grinning from ear to ear to hear that Aamer Anwar has seen off the fash and has been elected as Glasgow’s rector,” one law graduate wrote on Twitter.
Anwar fought off competition from 12 other nominees including Scottish judge Lady Hazel Cosgrove, who came second, and former Lib Dem MP Vince Cable, who was ranked third with 535 votes.
The lawyer’s election as rector comes after a heated campaign followed the nomination of Yiannopoulos, the so-called “darling of the alt-right”.
More than 3,500 “disgusted” people signed a petition demanding Yiannopoulos was removed from the ballot on the grounds he spreads “hate and violence”.
However, other students set up a group in support of the 32-year-old, saying his election would symbolise the end of an “intolerant, authoritarian” attitude on campus.
Yiannopoulos sparked further controversy when pledging he would outlaw the university’s Muslim Student’s Assocation if he was elected in order to “protect” LGBT students on campus.
The far-right provocateur said: “I mean, if the LGBTQ+GIMKULTRAUUIPU*(*(#$%* [sic] community wants to feel ‘safe’, surely their first priority would be the representatives of a homophobic, theocratic system currently on campus, right?”
Anwar - who will hold the role of rector for the next three years - said in a blog on The Huffington Post UK: “Milo Yiannopoulos is a vicious troll, who has built a lucrative career by playing the victim under the guise of being a free speech advocate.”
In the post written last week, he added: “As a nominee for the position of rector and alumni I am proud that my university has never welcomed such views and am confident this will always remain an institution that is diverse and inclusive and safe for people from all walks of life once Milo has crawled back to his Alt-Reich gutter if they will still have him.”
Yiannopoulos has been contacted by The Huffington Post UK about his defeat.
In February, British-born Yiannopoulos lost his job at Breitbart and was dumped by his book publisher after footage emerged of the agitator appearing to defend child abuse, and returned to the UK after gaining notoriety in the US.
In the videos, Yiannopoulos can be heard defending “relationships between younger boys and older men”, saying that society tends to “get hung up on this sort of child abuse stuff”.
He responded in a post on Facebook, stating that the videos of him were “selectively edited”. “I do not support pedophilia. Period,” he said.