Washington Navy Yard gunman Aaron Alexis allegedly suffered from various psychiatric issues, but was not deemed mentally unfit by the military — which could have stripped him of his security clearance.

He told Rhode Island cops he was hearing voices and being pursued by a sinister trio who were using a “microwave machine” to send “vibrations into his body.”

He was arrested in Seattle for shooting out a construction worker’s tires and blamed his rage on 9/11.

He was cited for misconduct while a Navy reservist at least eight times — slapped with administrative charges that included insubordination and disorderly conduct, according to reports.

An overhead image of Sharpshooters Small Arms Range in Lorton, VA. Sharpshooters released a statement Tuesday saying that Aaron Alexis, who perpetrator in the Washington Navy Yard shooting, bought a gun and ammunition there on Sunday.

(Google)

And for the last month, he was reportedly seeing a shrink to deal with a slew of problems, including paranoia and a sleep disorder.

But when Aaron Alexis, the doomed maniac who killed 12 people at the Washington Navy Yard, went to buy a gun on Saturday, he passed a federal background check with flying colors. It wasn’t clear whether he was ever committed to a psychiatric facility, an automatic disqualifier in the federal gun background check. He hadn’t been convicted of a felony, clearing another hurdle that would have made him ineligible.

Entrance to Sharpshooters in Lorton, Virginia.

(MIKE THEILER/REUTERS)

The 34-year-old Queens-born killer unleashed hell on Monday less than 2 miles from the U.S. Capitol before he was cut down by police.

It was the last act of a twisted soul who reportedly tried to deal with his demons by alternately drinking heavily, embracing Buddhism and playing violent zombie video games for up to 16 hours at a time.

An image of the interior of Sharpshooters Small Arms Range in Lorton, VA.

(ReasonTV via Youtube)

Now investigators are trying to figure out how Alexis was able to get the Navy security clearance that helped him to get on the base — and why nobody realized he was a ticking time bomb.

“It really is hard to believe that someone with a record as checkered as this man could conceivably get, you know, clearance to get ... credentials to be able to get on the base,” a clearly dismayed Washington Mayor Vincent Gray said.

A general view of Sharpshooters, a small arms range and gun shop, in Lorton, Virginia.

(MIKE THEILER/REUTERS)

Because of his troubled career as a reservist, Navy brass were trying to boot him on a general discharge, but the process bogged down. In 2011, when Alexis asked to leave the service, he was instead given an honorable discharge, the Washington Post reported, citing Navy sources. That favorable sendoff allowed Alexis to land a job as a civilian worker for a government subcontractor, giving him the security clearance.

In the wake of the shooting, Secretary of the Navy Ray Mabus ordered a security review for all Navy and Marine Corps installations.

The homepage of the website of Sharpshooters Small Arms Range in Lorton, VA.

(sharpshootersva.com)

There were red flags galore that Alexis was losing his grip on Aug. 7 when he frantically called the cops in Newport, R.I., from his hotel room. When they arrived, Alexis told them he’d had an argument with somebody at an airport in Virginia. He said that person “sent three people to follow him and to keep him awake by talking to him and sending vibrations into his body,” a police report revealed.

Alexis told the officers it got so bad he moved three times in a single night to get away from them. There were “voices speaking to him through the wall, flooring and ceiling,” said Lt. William Fitzgerald of the Newport police.

The front page of the NY Daily News September 18, 2013.

Alexis said “he was worried these people were going to harm him,” Fitzgerald said. “He said he never had a history of mental illness.”

But Alexis was lying. He was already seeing a shrink, the Associated Press reported. Still, the officers who encountered Alexis that night saw no reason to bring him down to the station. The Newport police did send a copy of their report to the Naval Station in that city, but Fitzgerald said he doesn’t know what they did with it. “They said they would follow up,” he said.

An image of the interior of Sharpshooters Small Arms Range in Lorton, VA.

(ReasonTV via Youtube)

In Fort Worth, Texas, where Alexis had been living, friends said they watched his life unravel — and were acutely aware that he never went anywhere without a loaded .45-caliber handgun.

One night in June 2011, when he was living in the apartment of the Thai restaurant owner he worked for, Alexis accidentally fired his gun. Nobody was hurt, but “Aaron was mortified,” the landlord’s wife, Kristi Suthamtewakul, said.

People exit the Washington Navy Yard with their hands above their heads as police responded to the reports of a shooter on the ground on Monday morning.

(SAUL LOEB/AFP/Getty Images)

She called it an “isolated incident,” not knowing that in 2010 he’d shot his weapon through the floor of an upstairs neighbor who annoyed him. Or that in 2004, he fired on a construction worker’s car in Seattle.

This past December, Alexis’ luck briefly seemed to improve when he landed a contract job in Japan, Suthamtewakul said. But he returned full of complaints.

Evacuated workers from the Navy Yard reunited with loved ones at a makeshift Red Cross shelter at Washington Nationals’ ballpark.

Alexis was also unlucky in love. He had been to Thailand in March 2012 and told everyone when he returned that he had gotten married. But there is no indication Alexis ever tied the knot.

Washington D.C. Mayor Vincent Gray speaks to the media near the scene of a shooting spree at the Washington Navy Yard on Monday.

(JIM LO SCALZO/EPA)

Relatives of the Suthamtewakuls told Britain’s Channel 4 News said that Alexis actually spent a lot of time at massage parlors when he was in Thailand. And when Alexis was spurned by the Thai woman he had a crush on, he blamed it on the fact that she “didn’t like black people.”

Alexis moved out of the Suthamtewakuls’ house in July when it got too crowded.

A helicopter flies over the Navy Yard on Monday morning.

(MLADEN ANTONOV/AFP/Getty Images)

He arrived in Washington on Aug. 25 and “stayed at local hotels in the area since that time,” FBI Assistant Director Valerie Parlave said Tuesday.

On Saturday, Alexis drove out to Lorton, Va., where he bought a shotgun and two boxes of shells from the SharpShooters Small Arms Range.

Gunman Aaron Alexis stormed the Washington Navy Yard and killed 12 people. He was killed during the shootout with police.

(Jacquelyn Martin/AP)

Michael Slocum, a lawyer for the gun store, said SharpShooters checked Alexis against the federal National Crime Information System database and he was approved. Before plunking down $419 for a Remington 870 shotgun, Alexis test-fired another weapon on the rifle range, the New York Times reported.

The Times said it was an AR-15 assault rifle and that Alexis was prevented from buying it by a state law that bars the sale of these weapons to out-of-state buyers. So instead, Alexis bought the kind of shotgun that cops favor.

Law enforcement officials initially reported that Alexis used a shotgun, a handgun and an AR-15 in the shooting — information that was reported by The News, The Times and dozens of other news organizations. Parlave on Tuesday said Alexis was packing “a shotgun” when he entered the Navy Yard’s Building 197.

“We also believe Mr. Alexis may have gained access to a handgun once inside the facility and after he began shooting,” Parlave said. “We do not have any information at this time that he had an AR-15 in his possession.”

At MedStar Washington Hospital Center, a female civilian Navy worker, shot in the shoulder, and a hero cop, wounded in both legs while trading shots with Alexis, were on the mend — both in fair condition, officials said. Another female civilian Navy employee, shot in the head and hand, was discharged.