John declares that "God is light, and in him there is no darkness." Those who claim to believe and live in God, yet do deeds of darkness, are liars.
John teaches against anyone who would claim to be without sin, for this would make God a liar. The statement that "God is light" is a key metaphor for 1 John: God is joy, warmth, enlightenment, and energy for the good. This passage is probably written against the false teachers, who may have claimed to be so full of God that they were without sin.
5 This is the message we have heard from him and proclaim to you, that God is light and in him there is no darkness at all. 6If we say that we have fellowship with him while we are walking in darkness, we lie and do not do what is true; 7but if we walk in the light as he himself is in the light, we have fellowship with one another, and the blood of Jesus his Son cleanses us from all sin. 8If we say that we have no sin, we deceive ourselves, and the truth is not in us. 9If we confess our sins, he who is faithful and just will forgive us our sins and cleanse us from all unrighteousness. 10If we say that we have not sinned, we make him a liar, and his word is not in us.
New Revised Standard Version Bible: Anglicized Edition, copyright © 1989, 1995 National Council of the Churches of Christ in the United States of America. Used by permission. All rights reserved worldwide. http://nrsvbibles.org