Canon law regarding same-sex sexual activity has been shaped through the decrees issued by a series of ecclesiastical councils. Initially, canons against sodomy were aimed at ensuring clerical or monastic discipline, and were only widened in the medieval period to include laymen. In the "Summa Theologica", Saint Thomas Aquinas stated that "the unnatural vice" is the greatest of the sins of lust. Throughout the Middle Ages, the church repeatedly condemned homosexuality, and often collaborated with civic authorities to punish gay people. Punishment of sexual "vice" as well as religious heresy was seen as strengthening the church's moral authority.