The 91-year-old Demjanjuk, who was born in Ukraine, was charged with 28,060 counts of accessory to murder. That figure matched the number of people who died while he was allegedly guarding the Sobibor death camp in Nazi-occupied Poland.
Demjanjuk was not charged with a specific crime, but prosecutors used the premise that if he was at the Sobibor camp, then he must have participated in the killings.
He showed no emotion as he sat in his wheelchair while the verdict was read out. He has denied the charges, but declined the opportunity to make a final statement to the court.
Presiding Judge Ralph Alt said Demjanjuk was a piece of the Nazis' "machinery of destruction."
"The court is convinced that the defendant ... served as a guard at Sobibor from 27 March 1943 to mid September 1943," Alt said, closing a trial that has lasted nearly 18 months.
Demjanjuk's son, John Demjanjuk Jr., said the defence would appeal. He asserted that "the Germans have built a house of cards and it will not stand for long."
Alt later ordered that Demjanjuk be freed pending appeal. That is not unusual in Germany and Alt said Demjanjuk, who is stateless and was deported from the U.S. two years ago, did not pose a flight risk.
Defence attorney Guenther Maull said it wasn't yet clear where Demjanjuk would go once he is freed, but he was likely to be hosted by the Ukrainian community in Munich. The court noted that Demjanjuk, who suffers from a variety of ailments, needs daily medical attention.
Demjanjuk denied ever having served as a Nazi guard. He maintained he was a Red Army soldier who spent the Second World War as a Nazi prisoner of war.
After the war, Demjanjuk moved to the United States, where he worked at an auto plant near Cleveland, Ohio.
In the late 1980s, Demjanjuk was tried in Israel, accused of being Ivan the Terrible, a notorious and sadistic prison guard who helped run the gas chambers at the Nazis' Treblinka death camp. He was convicted, and given a death sentence.
However, he was later freed after a court ruled he was a victim of mistaken identity.