Germany's president said Friday he was "deeply saddened and ashamed" about massacres in two Czech villages by Nazis in retaliation for the 1942 killing of Nazi top official Reinhard Heydrich.

Following a bomb attack on Heydrich by a Czech soldier trained in Britain, the Nazis flattened the Lidice and Lezaky villages within a retaliatory sweep that saw 15,000 people detained, killed or taken to concentration camps.

"The thought of the disdainful acts of terror in Lidice and Lezaky fills me with deep sadness and shame," Joachim Gauck said in a letter delivered to his counterpart Vaclav Klaus on Friday.

"Germany is aware of its historic responsibility," he added just days before the 70th anniversary of the massacres.

Heydrich -- one of the architects of the Holocaust and Nazi Germany's highest official in the Bohemia and Moravia protectorate on the territory of today's Czech Republic -- died of his wounds on June 4, 1942.

On June 10, 1942, the Nazis shot all men in the village of Lidice about 20 kilometres (12 miles) northwest of Prague, with a population of some 500.

They took the women to a concentration camp, while local children were either taken to Germany for re-education or poisoned in gas chambers.

On June 24, 1942, the Nazis killed more than 30 people in the village of Lezaky about 100 kilometres (60 miles) east of Prague.

"We will never forget the merciless crimes and unspeakable suffering the Germans committed against the men, women and children of Lidice and Lezaky," Gauck said.

"I would like to assure you and the Czech nation that we share the pain over the victims and sympathise with the survivors, some of whom are still alive," he added, calling the Heydrich killing a "courageous" act.

Klaus thanked Gauck for the letter, calling it a "positive gesture towards our country" and a "strong statement about the tragic occupation period and Nazi crimes." Seven paratroopers involved in the attack on Heydrich were killed or killed themselves on June 18, 1942 in a Prague church after fighting a Nazi commando for hours.

In October 1942, the Nazis also killed 254 helpers and family members of the paratroopers in a nine-hour series of executions at the Mauthausen concentration camp in Austria.