In 1751 Moser became a consultant on land reform to the Charles Eugene, Duke of Württemberg. He came into conflict with the Duke by opposing the Duke's absolutist tendencies. In July 1759 he was arrested and imprisoned without judicial procedure in solitary confinement in the fortress Hohentwiel, on the charge of authoring subversive writings. He completed his five-year detention with his mental and physical health and his faith in God unbroken. In order to meet his desire to write, without writing materials, he wrote religious songs on the walls with soot from the fireplace on the walls. In 1764, aged 63, he was released, in part due to the intercession of Friedrich the Great of Prussia, and was rehabilitated and restored to his position, rank and titles.
