[Nexus 5 Q&A, Help & Troubleshooting] Arko Sarkar:
I don't understand how exactly can I explain the situation, but I'll be as specific as I can. Please try to understand and help me from this.

My Nexus 5 is on Marshmallow without any roots etc ever. Now, the problem goes like this:

Suppose I press power button once, then screen should turn on/off once. Now this which happens normally in any phone happens in mine for first few times, then it starts like if I press power button once to turn screen off, it goes from off and turns back on, I again press power button, again from on it goes off and back on, this keeps on happening until I try my luck for it to off, but then sometimes it happens like after so much pressing it eventually show me "power off" option on screen(which generally should open if I hold the power button). Now once I encounter this "power off", no matter what I do, I power off/not, it'll automatically turn off, and this happened atleast 10+ times till date. So finally whenever I encounter "power off" option, which sometimes comes when I try to turn screen on or sometimes off, but never I hold the power button, but finally even If I don't click on power off, it'll power off.

And that isn't yet strange till there, normally now "Google" shows on screen when device is powered on, but here after encountering "power off" it shows "Google" and turns off.

This problem has happened to me from maybe starting a week ago, atfirst I ruled it as maybe hardware problem, cause after 3 factory resets, nothing changed, but then when I did wipe system cache and data format from recovery screen, everything got resolved. But this too remained for 2-3 days, again same problem started after it, I this time cleared system cache from recovery, and this time too it helped somewhat. so I can atleast say that it isn't a hardware power button problem, but something which I don't know what, always creating problems from software.

Now this problem has developed itself, because now the power button is kinda working okay, but now the "power off" comes on screen automatically, I can say once-twice a day, and as explained 'n' times before, once I encounter this, mobile turns off.

So everytime I've to turn phone on after this, and pray that it doesn't repeat, but it's yet going on, and i'm so pissed off by this phone, I regret buying this, honestly as till now mentioned I tried whatever I could/I knew, but nothing, nothing's helping me.

Also the problem intensifies when phone is on charge & "power off" is encountered, then the phone goes to turning off and "Google" is shown, then it shows "Google" then turns off, then it shows "Google" then turns off, and this loop keeps on going.

Finally I hope i'm as clear as possible, if someone can please help, I can guarantee any kind of format will just resolve the problem for few days only, and hardware power button problem i'm not feeling it as formats basically help it great, but anyway if I'm going wrong somewhere/need proper explanation somewhere then please tell but resolve this asap.

Phone's from India and it's been 1 year since bought and atleast a month from the Marshmallow OTA update and this problem started randomly without me doing anything I guess from a week ago.