The Gnostic Gospels: Were They Illegal?

A common theory is that the Nag Hammadi Library, a collection of Gnostic texts, were an illegal stash of books hidden from Orthodox Christian authorities. But recent scholarship has called this theory into question. Were the Gnostic Gospels legal?