Richard von Weizsaecker, then mayor of West Berlin, with U.S. President Ronald Reagan, center, and West German Chancellor Helmut Schmidt in 1982. (AP)

Richard von Weizsaecker, a onetime soldier in Hitler’s army who used his largely ceremonial office as president of Germany to denounce his country’s Nazi past and to condemn intolerance toward immigrants and other minorities, died Jan. 31. He was 94.

His death was announced by the office of the current German president, Joachim Gauck, but no other details were available.

Mr. von Weizsaecker was elected president of West Germany in 1984 and held the office as the country’s formal head of state for 10 years. During that time, he helped oversee the country’s reunification with East Germany in 1990.

In the German parliamentary system, the chancellor is the head of government and exercises more authority over the policies of the government than the president does. (Helmut Kohl was Germany’s chancellor throughout Mr. von Weizsaecker’s tenure as president.)

Nonetheless, the aristocratic, white-haired Mr. von Weizsaecker became perhaps the most popular political figure in Germany. He was, in essence, his country’s chief ambassador and used his presidential office as a platform to promote important matters of national and moral principle.

In an address to the parliament on May 8, 1985 — the 40th anniversary of Germany’s surrender at the end of World War II — Mr. von Weizsaecker directed a cleansing spotlight on the country’s greatest national shame, when he challenged his fellow Germans to take responsibility for the horrors of the Holocaust. He dismissed the commonly held notion that ordinary German citizens were not aware of the actions of the Nazi regime.

“There were many ways of not burdening one’s conscience, of shunning responsibility, looking away, keeping mum,” he said. “When the unspeakable truth of the Holocaust then became known at the end of the war, all too many of us claimed they had not known anything about it or even suspected anything.

“Who could remain unsuspecting after the burning of the synagogues, the plundering, the stigmatization of the Star of David, the deprivation of rights, the ceaseless violation of human dignity?”

Mr. von Weizsaecker, who spent seven years as an infantry officer in the German army during the war, was a potent symbol of national reflection and reconciliation.

“Anyone who closes his eyes to the past,” he said, “is blind to the present.”

He called on Germans to view May 8 not as a day of national surrender but as “a day of liberation. It freed us all from the system of National Socialist tyranny.”

Mr. von Weizsaecker’s forthright speech echoed around the world, and he was widely hailed as his country’s moral conscience. He traveled to Israel in 1985, attended the German premiere of the film “Schindler’s List” with the Israeli ambassador and, in 1993, visited the U.S. Holocaust Memorial Museum in Washington.

“President Weizsaecker has had a major, positive influence in enhancing Germany’s role and reputation on the world stage,” U.S. ambassador to Germany Richard C. Holbrooke said in 1994.

Mr. Weizsaecker repeatedly spoke out against intolerance toward immigrants and other minorities and attended memorial services for Turkish victims of neo-Nazi violence.

He also took a leading role in preparing Germany for reunification after the country had been divided at the end of World War II. As the mayor of West Berlin in the early 1980s, Mr. von Weizsaecker crossed the border and conducted talks with his counterparts in the communist-controlled eastern sector of Berlin.

As early as 1985, he urged Germans on both sides of the divide to think of themselves as one nation, and he was among the first leaders to call for the national capital to return to Berlin.

Richard Karl von Weizsaecker was born April 15, 1920, in a family castle in Stuttgart, Germany. He was from an aristocratic family of statesmen, theologians and scholars and had the inherited title of Freiherr, or baron.

His father, Ernst von Weizsaecker, was a senior official in the Nazi foreign ministry and served as the German ambassador to the Vatican. An older brother, Carl Friedrich von Weizsaecker, was part of a team of German scientists that tried unsuccessfully to develop a nuclear bomb during World War II.

Mr. von Weizsaecker studied in his teens at the University of Oxford in England and the University of Grenoble in France. He entered the German army in 1938 and took part in the German invasion of Poland on Sept. 1, 1939, the act that touched off World War II.

Two days later, his older brother Heinrich was killed in battle, which deeply affected Mr. von Weizsaecker’s view of the war. Stationed on the eastern front in Russia in 1943, Mr. von Weizsaecker later recalled, he and other German officers shot holes in a portrait of Hitler. Several of his friends participated in a failed plot to assassinate Hitler in 1944.

After the war, Mr. von Weizsaecker studied law at Germany’s University of Goettingen and joined his father’s defense team during the Nuremberg trials, when his father was charged with war crimes. Ernst von Weizsaecker was sentenced to prison and released after 18 months.

Mr. von Weizsaecker received a doctorate in law and worked for a German industrial conglomerate before being elected to the German parliament in 1969. He was mayor of West Berlin from 1981 to 1984.

Survivors include his wife of 61 years, Marianne von Kretschmann; and three children.

Mr. von Weizsaecker wrote several books about history and politics in which he advocated a moderate, centrist approach for Germany as it entered the 21st century.

When he left the presidency in 1994, he reflected on the powerful speech he had delivered nine years earlier, in which he asked Germans to own up to the legacy of the Holocaust.

“I wouldn’t take back a single word of that speech today,” he said.

A previous version of this obituary incorrectly reported that Mr. von Weizsaecker, as mayor of West Berlin, was the first political leader from West Germany to conduct negotiations with his counterparts in East Germany. Diplomatic relations between the two countries were established in the 1970s.