German police arrested 35 neo-Nazis in Berlin as they gathered to commemorate the death of high-ranking Nazi official Rudolf Hess.

Officers detained a total of 39 people on Saturday - four of them counterprotesters. 

More than 500 neo-Nazis had attempted to march to the site of the former prison in Berlin's western district of Spandau where Hess died on August 17, 1987, but were blocked by left-wing groups and local residents.

Neo-Nazi protesters were frisked and funnelled through tents where police checked them for weapons, forbidden flags and tattoos showing symbols banned in Germany, such as the Nazi swastika.

A number of far-right protesters emerged from the tents with black tape covering their arms or legs.

READ MORE: German 70-year-old anti-fascist defaces neo-Nazi art

Twelve far-right protesters were being investigated for displaying forbidden symbols, police said.

Jossa Berntje, a 64-year-old counterprotester from the western city of Koblenz, cited her parents' experience of living under the Nazis as her reason for coming.

"The rats are coming out of the sewers," she told the Associated Press news agency.

Counterprotesters raise a poster reading, 'Nazis, leave Spandau' [Christian Mang/Reuters]

Berntje added that she was also marching in solidarity with anti-racists in the United States after an August 12 rally in the eastern city of Charlottesville turned deadly.

In Charlottesville, a white supremacist mowed down a crowd of anti-racist protesters, killing 32-year-old Heather Heyer and injuring dozens.

Many have criticised US President Donald Trump's insistence on blaming both sides for violence in Charlottesville, essentially equating the actions of white supremacists to those countering them.

OPINION: Confronting the colonial roots of racism

"[President Donald] Trump has made [racism] socially acceptable," Berntje said.

Hess, who received a life sentence at the Nuremberg trials for his role in planning World War II, died aged 93.

Allied authorities ruled his death a suicide, but Nazi sympathisers have long claimed he was killed and organise annual marches in his honour.

Those annual far-right marches used to take place in the Bavarian town of Wunsiedel, where Hess was buried until authorities removed his remains.

Source: AP news agency