Two fathers fought against each other in World War II, commanding opposing armies across the deserts of North Africa. Each was a general who bore the title of field marshal: Bernard Montgomery, the British military leader who led Allied forces to victory at the second battle of El Alamein in Egypt in 1942; and his German counterpart, Erwin Rommel, known as the “Desert Fox.”

Years later, after the smoke of war had cleared and the generals had died, their sons formed an unlikely peacetime alliance. Each of them — David Montgomery and Manfred Rommel — was his father’s only son. Both were born in 1928, served briefly in the military and had successful careers. They also shared parallel personal histories that perhaps only they could fully understand.

“We first met in 1979 when he came on an official visit to Britain,” Mr. Montgomery told Britain’s Telegraph newspaper in 2013. “We were the same age, to within three months. We were the only sons of famous, opposing generals. We had a great deal in common.”

Manfred Rommel spent almost 22 years as the mayor of Stuttgart, Germany, charting a progressive path marked by reconciliation and support for the city’s Jewish and immigrant communities. He died in 2013 at 84.

David Montgomery, who inherited his father’s title of Viscount Montgomery of Alamein when the field marshal died in 1976, was an engineer and business executive and later a member of the British Parliament. He died Jan. 8 at age 91; his family announced his death with a notice in the Telegraph without providing further details.

Mr. Montgomery also co-wrote a book about his father, who drove Rommel’s forces across the desert from Egypt to Tunisia before forcing them to surrender in 1943, and later led Allied ground forces during the D-Day invasion of 1944.

“I remain convinced that as a general, both in the desert and in northwest Europe, my father was the right man at the right time in the right place,” David Montgomery wrote in “The Lonely Leader: Monty 1944-45” (1994). He added, however, that the praise lavished on his war hero father “had its effect on his character,” resulting in “friction and irritation” with his only son.

David Bernard Montgomery was born Aug. 18, 1928, in Camberley, England. His mother died in 1937 of an infection caused by an insect bite.

Young David Montgomery saw little of his father during the early years of World War II and in 1942 was placed under the guardianship of a schoolmaster, Tom Reynolds, and his wife, Phyllis. The general sometimes sent gifts of oranges and chocolate — scarce commodities in wartime England — to his son at school.

After the war, David Montgomery served in an army tank regiment before graduating from the University of Cambridge in 1950. He worked in Asia and South America for the Shell oil company, then became an executive for Yardley, the cosmetics manufacturer. Fluent in Spanish and Portuguese, he served on the boards of international companies before launching a consulting firm that was involved in South American business opportunities.

He held local government positions in London before entering the House of Lords, where he served off and on from the 1970s until 2015.

His marriage to Mary Connell ended in divorce. Survivors include his wife since 1970, the former Tessa Browning, the daughter of novelist Daphne du Maurier; two children from his first marriage; and several grandchildren and great-grandchildren.

Manfred Rommel had a markedly different path in life. Drafted into the German military at 14, he was at home with his father on Oct. 14, 1944, when Nazi officers placed Erwin Rommel under arrest, charging him with participating in a failed plot to assassinate Adolf Hitler.

In a statement made in 1945, Manfred Rommel described what happened next: “About three quarters of an hour after that I met Father just coming out of my Mother’s room. He then told me that . . . Hitler had given him the choice between taking poison or being brought before the People’s Court.”

As he rode away in a car, Erwin Rommel took a cyanide pill and died instantly. His son, then 15, later deserted his military post and surrendered to French forces. He held positions in local government before becoming mayor of Stuttgart in 1974. He was considered one of Germany’s leading liberals but did not seek higher political office.

After the field marshals’ sons first meeting in 1979, they gathered over the years at military reunions and other events, becoming close friends.

“Our fathers are ever present in our lives,” Mr. Montgomery said in 2013.

Both sons spoke in 1992 at Westminster Abbey for a 50th-anniversary commemoration of the Allied victory at El Alamein. Each read from the Bible, with Mr. Montgomery reciting a verse from Isaiah 35: “The wilderness and the solitary place shall be glad for them; and the desert shall rejoice, and blossom as the rose.”