Why won't my iphone 5 reset to factory settings?

I held the power and home button until the apple logo came up, then i released the power button and kept holding the home button. But as i kept holding the home button the apple logo stayed on the screen and the phones lockscreen popped up…

Added (1). can anyone tell me what i'm doing wrong?

Added (2). @T-Bone i can't go into settings… I forgot the passowrd

The only way to reset an iPhone to factory settings is by accessing the Settings. If you are the owner of this device, you may reset to factory settings on iTunes.

If you do not own this device, iTunes will communicate with the iPhone until the passcode is entered.

This is a security feature implemented by Apple recently.

IPhone reset:

Settings > General > Reset (at bottom of screen).

You are trying to do a DFU restore, try connecting the phone to your PC, start iTunes, turn on the phone press and hold the home and power button until the phone goes blank, then release the power button ( the one on top of the phone), keep holding the home button until you get a notification on iTunes.