Armin Meiwes, a 42-year-old computer expert, had no "base motives" in the crime, a state court ruled, sparing him a murder conviction.
Prosecutors had sought a life sentence, calling Meiwes a "human butcher" who acted simply to "satisfy a sexual impulse." They said they would appeal the verdict.
The defense argued that since the victim volunteered to be killed and eaten, the crime should be classified a mercy killing, which carries a five-year maximum penalty.
Before the verdict, Meiwes looked calm, chatting with his attorney and occasionally grinning for cameras allowed inside the courtroom. After the sentence was read, he shook his lawyer's hand and nodded curtly to the photographers.
Explaining the verdict, Presiding Judge Volker Muetze said Meiwes' intention was not evil but "the fulfillment of his fantasy."
His primary motive was "the wish to make another man part of himself," Muetze said. "Meiwes reached this bonding experience through the consumption of the flesh."
When his trial opened Dec. 3 in the central city of Kassel, Meiwes confessed in detail to killing Bernd Juergen Brandes, 43, in March 2001 at Meiwes' home in the town of Rotenburg.
Brandes traveled from Berlin in reply to an Internet advertisement seeking a young man for "slaughter and consumption." Meiwes testified that Brandes wanted to be stabbed to death after drinking a bottle of cold medicine to lose consciousness.
"Bernd came to me of his own free will to end his life," Meiwes said in his closing statement in court Monday. "For him, it was a nice death."
Still, he said he regretted the killing.
"I had my big kick and I don't need to do it again," he said. "I regret it all very much, but I can't undo it."
A grisly video he made of the act was shown to the court during a closed session.
A doctor testified that Brandes died from loss of blood and that the medication, along with a half-bottle of liquor and 20 sleeping pills he took beforehand, could not have lessened his pain.
Several experts have testified that Meiwes was fit to stand trial and was not mentally ill.
Police tracked down and arrested him in December 2002 after a student in Austria alerted them to a message Meiwes had posted on the Internet.
"If I hadn't been so stupid as to keep looking on the Internet, I would have taken my secret to the grave," Meiwes said in his closing statement.
By Frank Leth