A 63-year-old Boulder man accidentally shot himself in the knee around 2 a.m. Tuesday, apparently while sleepwalking, police said.

Sanford Rothman, who lives on Mineola Court in southeastern Boulder, told police he woke up to a "bang" and discovered he was shot in the left knee. He said he did not have a clear recollection of the incident.

Rothman was taken to Boulder Community Hospital, where he was treated and released, police said.

An investigation found that the wound was accidental and most likely occurred while Rothman was sleepwalking.

Boulder police Sgt. Paul Reichenbach said that according to the police report, Rothman keeps a 9mm handgun near his bed, and he takes prescription medication for pain. No alcohol or illegal drugs played a role in the incident.

Reichenbach said no one else was in the house at the time.