The Church of Sweden minister admitted to spending a lot of time at work viewing pornographic websites.
But his habits might have gone undiscovered had not the sites he visited given rise to a lethal computer virus.
"He recently decided to resign," Charlotta Novosel, a legal spokeswoman for the church, told Metro.
The church authorities have not yet decided whether the minister should be formally defrocked.
The number of sex-related cases involving men of the cloth has skyrocketed in recent years, according to Metro.
"Priests are people too," Archbishop Anders Wejryd told the paper.
"But I have no understanding at all for someone sitting and surfing for porn on the parish computers," he added.
A pastor in Gothenburg recently came under scrutiny for moistening post-it notes with his penis and sticking them up in an office.
After an official review, the authorities decided to allow the minister to remain in his job.