The court in the northeastern canton of Glarus ruled that the farmer and his family no longer needed to pay some 70 Swiss francs (£47) a year to keep the sanctuary lamp of the Naefels Catholic church burning.
The debt dated back to 1357, when a certain Konrad Mueller killed a man named Heinrich Stucki.
To save his soul and avoid revenge attacks from the victim's family, Mueller gave a sanctuary lamp to a local church and vowed to finance its fuel "for eternity".
If he failed to do so, his land would go to the Church, Swiss public broadcaster RTS reported.
Over the centuries, owners of Mueller's old land have continued to pay for the lamp oil.
But when the Naefels parish wanted to register this arrangement officially with the municipality, one of the landowners balked.