K12 Engine wouldn't start, dash electronics clicking on and off

Hi, I'm wondering if anyone has had the same problem as the one I had this morning. I went to our newly purchased 56 Micra Sport this morning to take it for an MOT to check its safe to drive. I started out by first resetting the time and trips on the computer and as soon as I'd finished doing that the dash went blank and I noticed the fans on the climate control had stopped dead. The climate control screen was flashing on and off and when I turned the radio on it was doing the same. I turned the ignition and the dash board lights went crazy turning on and off all over the place whilst I could hear from the engine bay a clack-clack-clack noise like someone was rattling a hammer around inside there.

I turned the key to off and back to position 2 and the stereo and climate control refused to power up at all but the dash lights came on so I tried it again. Same clacking sounds from the engine bay and no turn over. I opened the bonnet, removed the battery and put it on a charger with the intention to leave it charging all day. I decided, out of desperation, to try fitting it back in the Micra after 5 or 10 minutes. Turned the key and it started first time with no unusual noises. The garage had no trouble starting it for the rest of the day and said the battery was healthy when tested. The alternator appears to be working this evening because when the engine is running and the lights are turned on the engine labours slightly.

I can't explain the engine not starting and am worried it might happen again when without tools. I have a feeling it's the immobiliser kicking in but why would it do that? I spent a few minutes with it in position 2 before trying to start it - could it have thought I was trying to steal the car? Is there a way to disconnect power without pulling the battery posts off if it happens again? Pull a fuse perhaps?