A mild strain of Gnostic philosophy was already growing in the first century just decades after the death of Jesus. The apostles, in their teaching and writings, went to great lengths to condemn these beliefs as being opposed to the truth of Jesus, to whom they were eyewitnesses.
Check out, for example, what the apostle John wrote near the end of the first century:
Who is the great liar? The one who says that Jesus is not the Christ. Such people are antichrists, for they have denied the Father and the Son. (1 John 2:22, NIV).
Following the apostles’ teaching, the early church leaders unanimously condemned the Gnostics as a cult. Church father Irenaeus, writing 140 years before the Council of Nicaea, confirmed that the Gnostics were condemned by the church as heretics. He also rejected their “gospels.” But, referring to the four New Testament Gospels, he said, “It is not possible that the Gospels can be either more or fewer in number than they are.” 
Christian theologian Origen wrote this in the early third century, more than a hundred years before Nicaea:
I know a certain gospel which is called “The Gospel according to Thomas” and a “Gospel according to Matthias,” and many others have we read—lest we should in any way be considered ignorant because of those who imagine they possess some knowledge if they are acquainted with these.
Nevertheless, among all these we have approved solely what the church has recognized, which is that only four gospels should be accepted.
When it comes to the Gnostic gospels, just about every book carries the name of a New Testament character: the Gospel of Philip, the Gospel of Peter, the Gospel of Mary, and so on. But were they even written by their purported authors? Let’s take a look.
The Gnostic gospels are dated about 110 to 300 years after Christ, and no credible scholar believes any of them could have been written by their namesakes. In James M. Robinson’s comprehensive The Nag Hammadi Library, we learn that the Gnostic gospels were written by “largely unrelated and anonymous authors.”
New Testament scholar Norman Geisler writes, “The Gnostic writings were not written by the apostles, but by men in the second century (and later) pretending to use apostolic authority to advance their own teachings. Today we call this fraud and forgery.”