I know very little about Luther and it's been explained to me by countless Catholics that Luther left the church but that's not accurate. Luther was excommunicated. After the church excommunicated Luther, he was then sentenced to death by the government.

Luther excommunicated by Catholic Church
This Day in World History On January 3, 1521, Pope Leo X issued the papal bull Decet Romanum pontificem (“It pleases the Roman Pontiff”), which excommunicated Martin Luther, a German theologian and monk who had been causing the Roman Catholic Church no end of trouble since 1517. With that, the...
blog.oup.com