David Laffer, 33, was ordered held without bail. Suffolk County Assistant District Attorney John Collins called the shooting at Haven Drugs "the most cold-blooded robbery-homicide in Suffolk County history."
His defense attorney Mary Elizabeth Abbate argued for a reasonable bail.
Collins said investigators recovered a matching fingerprint at the crime scene, and they also recovered the.45-caliber gun believed to have been used in the shootings. The weapon was registered to Laffer, and was found disassembled in his home, authorities said.
His wife, Melinda Brady, was accused of driving him to the drug store before he walked in and started firing, officials said. He wore a fake beard, glasses, baseball hat and loose sweat shirt to disguise himself, they said.
Brady was hospitalized Thursday but police would not say why. She was charged with robbery and obstructing governmental administration, it's not clear when she would be arraigned. She told reporters earlier that "he did all of this" for her.
"He was doing it because he lost his job and I was sick," Brady said as she was led from Suffolk police headquarters in Yaphank early Thursday morning.
"He did it. He did all of this," Brady, 29, told reporters. She seemed addled and disheveled in an over-sized yellow T-shirt and black shorts.
Neither Laffer nor Brady had a previous criminal record.
Suffolk County Police Commissioner Richard Dormer that Laffer's name was also on a list at the pharmacy of people who had filled prescriptions in the past. The couple was high when they were arrested Wednesday, he said.
Police circulated surveillance photos of the gunman after the weekend shooting, and received more than 400 tips in an intense manhunt that ended Wednesday.
Laffer, who a few years ago proposed to his now-wife at a New York Islanders hockey game, said nothing as he was led from police headquarters Thursday wearing a bullet-proof vest.
He had two black eyes, injuries to forehead and nose, the result of his "resisting arrest," police said.
Laffer served in the Army from 1994 until 2002 and attained the rank of private first class, said Mark Edwards, a spokesman for the U.S. Army Human Resources Command in Fort Knox. While in the service, he worked as an intelligence analyst.
Friends and neighbors said they did not believe Laffer, whom they described as polite and friendly, was the shooters. They said if there were drug problems, they did not see it. He lived at his family's home in Medford with his mother, Pam, and his wife.
According to their wedding announcement, Laffer and his future wife met while they were out to dinner with mutual friends, and he proposed to her at an Islanders game. Next-door neighbor Trish Bohlert attended the wedding and said Laffer was always friendly.
"Something must have made him snap, because his personality, I can't picture him robbing a store, much less hurt people," she said.
Zaida Ayala, a longtime neighbor, said Laffer is "a guy that I feel comfortable with, a guy that I could be out, 1 o'clock in the morning in my backyard, and he could be in his backyard and I wouldn't run inside and go get my husband."
She said she does not believe he is the shooter.
"You could give me a million dollars to pick somebody and he would be the last person I would've picked," she said.
His Facebook page showed he was interested in weapons and science fiction. He lists himself as a fan of the conspiracy-based science fiction drama "Dark Skies" and the Spike TV show "Deadliest Warrior." He also lists Springfield XD, a type of pistol, among his interests.
The shootings happened Sunday at about 10:20 a.m. inside Haven Drugs, a pharmacy in a small cluster of medical offices in Medford, about 60 miles east of New York City.
Everyone in the pharmacy at the time of the robbery was killed. The victims were identified as two employees, pharmacist Raymond Ferguson, 45, of Centereach, and store clerk Jennifer Mejia, 17, of East Patchogue, and two customers, Bryon Sheffield, 71, of Medford, and Jamie Taccetta, a 33-year-old woman from Farmingville.
"We know this arrest won't bring back Raymond, Jennifer, Bryon and Jamie, but we're hoping this will provide some sense of closure to the victims' families," Dormer said. "And that this provides piece of my mind to the community."
It was the worst mass killing in Suffolk County since 1974, when a man shot six relatives to death in Amityville, a crime that spawned horror films and a book after the family's home was said to be haunted.
At the pharmacy, about a mile and a half away from the Laffer home, bouquets of fresh flowers, and stuffed animals lined the shuttered storefront. A sign read, "closed until further notice."