A terrorism expert at the University of St Andrews has been named as the co-author of the McLibel pamphlet that attacked fast food firm McDonald's and triggered the longest civil trial in English legal history.

Dr Robert Lambert is a former undercover police officer and now a lecturer in terrorism studies at the university.

A new book, due for release on Monday, claims Dr Lambert co-wrote the defamatory six-page pamphlet in 1986.

His role in its production has been the subject of an internal Scotland Yard investigation for several months.

Dr Lambert, who has taught at St Andrews since 2008, reportedly used the alias Bob Robinson during a five-year undercover investigation when he posed as an environmental activist to infiltrate the London Greenpeace group – which was separate from the international Greenpeace movement. He was working for the special demonstration squad (SDS), a now-disbanded Metropolitan Police unit that targeted political activists.

McDonald's sued two environmental campaigners over the leaflet in a three-year High Court case widely considered a public relations disaster for the corporation.

However, it was not disclosed during the £10m civil legal proceedings brought by McDonald's that an undercover police officer helped to write the leaflet, entitled What's wrong with McDonald's: Everything they don't want you to know.

The document accused the firm of everything from selling "addictive" junk food, to being complicit in third world starvation and exploiting children through advertising.

In 1990, McDonald's brought libel proceedings against five London Greenpeace supporters for distributing the pamphlet on the streets of London.

The case was settled in June 1995 when McDonald's offered to donate an undisclosed sum of money to a charity chosen by two of the activists.

Claims of Dr Lambert's role follow unrelated revelations that undercover officers used dead children's identities and that some had sexual relationships with the targets of their operations.

Dr Lambert has also been accused by an MP of leaving a bomb in a Debenhams store in London in the 1980s to prove his commitment to animal rights. He has denied the allegation.

An investigation by the Metropolitan Police into undercover policing, Operation Herne, has been ongoing since October 2011.

Derbyshire Police Chief Constable Mick Creedon was brought in to oversee the operation and confirmed it was "common practice" for undercover officers within the SDS to use dead children's identities.

Dr Lambert worked for the police from 1977 until 2007, dealing primarily with counter-terrorism operations ranging from the IRA to al-Qaeda.

His academic profile on the St Andrews University website says: "Throughout his police career Lambert placed value on street or grass-roots perspectives over more rigid top-down security approaches to counter-terrorism."

The Metropolitan Police said the force "recognises the seriousness of the allegations of inappropriate behaviour and practices involving past undercover deployments".

It added: "Operation Herne is a live investigation, four strands of which are being supervised by the Independent Police Complaints Commission. It would be inappropriate to pre-judge its findings.

"The Metropolitan Police Service must balance genuine public interest in these matters with its duty to protect officers and former officers who have been deployed undercover, often in difficult and dangerous circumstances.

"We are not prepared to confirm or deny the identity of individuals alleged in the media to have been working undercover."

St Andrews University said it had no comment to make.

We are not prepared to confirm or deny the identity of people alleged in the media to have been working undercover