An academic at a leading Scottish university, exposed as a former undercover police officer who had sex with his female targets, has quit his post.

Bob Lambert, who also fathered a child with a woman he was spying on, has left St Andrews University and another higher education body amid an outcry about his past.

Mr Lambert worked for the Metropolitan Police's Special Demonstration Squad (SDS) in the 1980s and was paid to infiltrate animal rights and environmental groups.

However, his behaviour was unmasked in 2011. He had sexual relationships with women linked to groups he spied on and assumed a fake identity by taking the name of a dead child.

Last night Mr Lambert, who has faced intense criticism and scrutiny over his covert police activities, said: "I have resigned from my part-time teaching positions at the University of St Andrews and London Metropolitan University and would like to take this opportunity to thank management, colleagues and students at both institutions for their kindness and support.

"Henceforward I will pursue my academic interests in responses to terrorism and political violence as an independent researcher. I will also continue to co-operate with the investigations and inquiry into undercover policing."

The Herald: Former undercover cop Bob Lambert admitted taking a dead Plumstead child's identity in a Channel 4 Dispatches programmeMr Lambert, as an undercover officer, helped secure the convictions of two figures linked to the Animal Liberation Front responsible for firebombing branches of Debenhams.

Green MP Caroline Lucas used parliamentary privilege to air allegations he was behind another attack on the same company in the 1980s.

The SDS has also faced allegations it spied on the family of murdered teenager Stephen Lawrence.

Despite the Debenhams allegations, Mr Lambert has been a lecturer in terrorism and political violence at St Andrews University.

His “twin research interests” are community-based approaches to counter-terrorism and Islamophobia.

Earlier this month, The Herald's sister paper the Sunday Herald revealed campaigners had written to University principal Louise Richardson to call for his sacking.

The Herald:

Picture: How the Sunday Herald broke the story

The letter, signed by George Monbiot, who was awarded an honorary doctorate from St Andrews, stated: “We believe that his [Lambert] past conduct as a central figure in the Metropolitan Police’s Special Demonstration Squad means that he is supremely unsuitable for teaching and shaping the thoughts of others in his current position.

“The SDS’ abuse of citizens and undermining of legitimate campaigns are one of the darkest corners of Metropolitan Police history. Lambert is no role model and should not be trading on his abuses.”

The letter gave a detailed account of Lambert’s history as an SDS officer and noted: “One has to wonder, if all this is not enough to make him unfit to teach others, what does it take? With fresh revelations coming to light almost weekly and the public inquiry about to begin, we can be confident there will be more."

The Herald: George Monbiot

Picture: Monbiot

It was also signed by campaigners Lois Austin, Dave Smith and Helen Steel, who had a relationship with another undercover officer without knowing his real identity.

At the time, a university spokesman said Lambert had been "entirely open with the university and his students about his past", adding that his teaching was "highly valued by students".

It is understood the university and Lambert parted company last Friday.

Lambert has admitted having sexual relationships with activists and fathering a child with one woman, but denies the Debenhams claims.

The woman he had a child with, known as Jacqui, received around £425,000 in compensation over the trauma of the father of her son being a police spy.

She told the BBC: "He watched me give birth remember and, to me, he was watching his first child being born. He was there throughout the labour. And that is something so intimate between a man and a woman. And I shared that with a ghost, with someone who vaporised."

The activities of covert police units are to be examined by the Pitchford Inquiry, set up by the UK Government in the wake of the claims about various undercover officers.

MSP John Finnie said: "This vindicates all those people who were campaigning to have people of integrity in teaching posts. Mr Lambert is not, and will never be, suitable in a teaching role. I'm delighted at this development."

A university spokesman said: "He tendered his resignation with effect from the end of the current term.”