Why the Diet of Worms?
By 1521, the Pope Leo X had alreday excommunicated Luther. However, if his word was to be widely believed, it needed political support behind it.
He tried asked the Elector of Saxony, Frederick the Wise, but he was set on protecting Luther.
Then he asked Charles V, the Holy Roman Emperor. Charles was in favour of condemning Luther, however he had sworn an oath not to condemn anyone without a trial. Although Leo X protested, he had no choice but to give Luther a hearing.
And so Luther was summoned to the Imperial Diet at Worms in March 1521. At first, Luther declined to come, however after being promised a safe passage there and back, he agreed.
The Diet of Worms
When Luther arrived at Worms, he did not yield to Imperial pressure.
Luther was shown a selection of books, pamphlets and letters, all of which, claimed Charles, contained heretical writings, and all of which were published under Luther's name. Luther was given two questions: firstly, had he written those books, and secondly, would he recant the teachings contained in them.
To the first question, Luther answered yes, and to the second, he asked to have some time to consider.
Reluctantly, the Diet gave him one day.
The next day, Luther appeared before them all again. He replied that, if he were shown by reason or by the scriptures that any of his works contained heretical teachings or inaccuracies, he would recant them, but if not, he would not. Alledgedly, he claimed "here I stand: so help me God", but there is no evidence for him ever having said this.
The Outcome of the Diet
Other than the Elector of Saxony, none of the other princes or delegates were bound to protect Luther. However, there were those inclined to support him: those with anti-papal sentiment, and those with anti-Hapsburg sentiment, who were against the Emperor.
Charles waited until the most important of these had left, and then presented the remaining Diet with an Edict, which they all accepted. This Edict stated that Luther was a heretic and should be outlawed, placng him under the ban of the Empire. No-one was permitted to protect, aid or give shelter to Luther or any of his supporters.
However, little attempt was made to enforce it, and by this time Luther had already gone home.
However, despite the fact that little attention was paid to the Edict of Worms, the Elector of Saxony was still worried that Luther might be in danger on his way back from Worms to Wittenburg.
In order to take Luther off the world stage for a short while, for his own safety, he arranged for a party of his own soldiers to "kidnap" Luther and transport him to Wartburg Castle. There, Luther was "imprisoned" for several months in order to create the illusion that he had vanished, been murdered or gone into exile to protect himself from others that wished him harm.