It depends who... tells the story. I've heard it now from both Kylo Ren and Luke, and putting them together -- I think this is what I believe happened.
Ben struggled with an attraction to the darkside. It became far worse once he realized who his grandfather was and Luke [...] sensed that and went to confront Ben about it. He got to us hut, Ben was asleep and Skywalker could feel how bad it was; how dangerously close to the darkside Ben was. So he thought he should kill him - his own nephew - in that instant, in response to his own fear that history would repeat itself.
Luke [...] came to his senses a moment later - as he tells the story. He said he never would have gone through with it - but it was too late. When he turned on his lightsaber, it woke Ben up and he attacked. He left with some of Luke's students, killed the rest, and thought Skywalker had died in the destruction of the temple.