The retired officer said its actions, in the 1970s, included demonstrations against cricket and rugby tours.
The movement caused "problems and dangers" and was a "nuisance", he said.
The elderly officer is the first to give evidence at the Undercover Policing Inquiry.
The inquiry is looking into the targeting of the peer and former Labour cabinet minister Lord Peter Hain.
The officer has admitted lying to a court about his identity and, separately, assaulting an activist after he was nearly unmasked.
He is among former members of the special demonstration squad, a now-disbanded Metropolitan Police unit that was tasked to infiltrate a wide range of political organisations over some 40 years.
Known officially as "HN298", the officer adopted the name and birthday of "Michael Peter Scott" - a real person whose details he had found in public records.
From 1971 he infiltrated the anti-apartheid movement and, in particular, the Young Liberals.
The campaign, jointly led by the then student Peter Hain and others, organised highly-disruptive but peaceful stunts against sporting tours involving whites-only South African teams.
Those protests are now regarded as being a key moment in the growth of the global anti-apartheid movements.
Last week, Lord Hain told the inquiry that undercover officers who had monitored him had been on the "wrong side of history".
Over a year or more, Scotland Yard learned information about Lord Hain's family home, the names of his then teenage sisters, the car he drove and the names of other people around him.
Lord Hain was Northern Ireland secretary between 2005 and 2007, and twice served as the secretary of state for Wales.
None of the intelligence reports included any actual evidence of criminal plotting.
One did, however, warn that liberals might protest against traffic in Putney, south-west London.
On Tuesday HN-298 launched a defence of the information that was gathered on Lord Hain and others, saying Scotland Yard bosses needed it to work out who was genuinely "of interest".
The activities of his unit had been "well-directed" and it had been "money well-spent".
"Their anti-apartheid activities included demonstrations against cricket tours and rugby tours," he said.
"They were things of public disorder, and they were of interest."
David Barr QC, counsel to the inquiry, asked why the officer had not considered infiltrating the far right instead.
"Well, as far as I know, there weren't any problems with the far right," he replied.
"I guess you mean the National Front. I wasn't aware of too many demonstrations organised by them."
Were his targets attempting to overthrow democracy? asked Mr Barr.
"They may well have been but I don't think so," replied the officer.
"It was not all about overthrowing democracy but nuisance - they caused problems and dangers to the public.
"This is the role of the police, to look after us."
In May 1972, HN298 joined anti-apartheid demonstrators in an attempt to prevent the England rugby team flying to South Africa, by blocking their team bus.
He was charged with obstruction, and documents show his superiors decided he should lie in court by giving his fake name.
This was technically a serious crime, but it was justified on the basis that it was essential to prevent blowing the operation against the Young Liberals.
HN298 was subsequently convicted under his false name in court, and fined.
He did not know if the real Michael Scott, who would receive the criminal record, was still alive.
The fine was put on Scotland Yard expenses.
He insisted that some groups he followed later in the 1970s were dangerous, including Irish nationalism campaigners that he linked to the IRA.
When one campaigner against British troops in Northern Ireland suspected that HN298 was in the police, the undercover officer punched him so hard on the nose that he broke his own finger.
David Barr QC asked: "What made you think it was acceptable to commit a crime of violence against a member of the public?"
"It was acceptable to me at the time," said the officer. "I felt it was something I had to do."