#0838 Medium crime

A detective investigates a robbery and realizes he himself committed it. He has a perfect alibi and did not commit it while sleepwalking. How is this possible?