A month before entering Washington's Navy Yard and fatally shooting 12 people, ex-naval officer Aaron Alexis twice visited emergency rooms and asked doctors to treat his insomnia.
During his first visit on August 23, Alexis went to a VA hospital in Boston and was prescribed sleep meds. On August 28, Alexis went another VA hospital in D.C. and demanded a refill. Though Alexis told doctors at the time that he hadn't considered hurting himself or others (if he'd answered affirmatively, authorities would have been forced to take action) he'd already had at least one psychotic episode earlier that month, during which he'd told police that he was being followed, harassed via microwave, and had heard voices through the floors and ceilings.
Which raises the odd question: can insomnia cause psychosis? No — but chronic sleep deprivation has been heavily linked to psychotic episodes, hallucinations, and other classic symptoms of psychosis. Let's be clear: psychosis isn't a disorder in and of itself, but is defined as a "loss of contact with reality," and is typically cited as a symptom. Insomnia is difficult to directly link to a break with reality because it's an umbrella disorder, split into three categories (transient, acute, and chronic) and sub-divided into groups thereafter.
What does this mean for those who go without sleeping for long periods of time, either regularly or sporadically? In short, depriving your brain of rest is pretty much the worst thing you can do to it: it's impossible to stay awake for a long period of time because your brain will go into micro-sleeps, and lab animals kept forcibly awake have died, and sleep deprivation is routinely classified as a form of torture. We can only speculate at this point about what condition Aaron Alexis was in at the time of the shooting and in the lead up to it. But the fact that he was going to the emergency room for insomnia might imply that he thought his lack of sleep was an emergency.
It gets more complicated. Sleep disorders are classically referred to as psychiatric disorders, unless evidence of a physical disease (such as sleep apnea) is present. It's a chicken-and-egg situation: a mental issue can lead to insomnia, which in turn can lead to sleep deprivation, which is turn can lead to psychosis ... but that mental issue might be psychosis to start with.
For example, since Alexis told police that he believed someone he'd fought with at an airport was radiating messages through his hotel room, he had good reason not to sleep — because he genuinely believed, as happens with psychotic patients, that he was under threat.
That said, some insomnia studies have found that sufferers can complete tasks to nearly the same degree as healthy sleepers, and recorded incidents where insomnia directly caused psychosis are rare. Symptoms responding to sleep deprivation from insomnia are usually more "low-level," such as a wandering mind, a short attention span, and slow mental reactions.