MONTCLAIR, N.J. — They skulked in and out like criminals, shoulders hunched, heads down, declining to comment.

It was the opening of New Jersey’s first and so far only medical marijuana dispensary, in downtown Montclair, on Thursday, nearly three years after the law allowing such enterprises was passed. The opening had been delayed by political battles over whether it would lead to the de facto legalization of marijuana.

Patronizing the dispensary was perfectly legal, provided a doctor’s prescription for a list of specified medical conditions was presented, yet the pioneering visitors — it was not clear if they were patients — seemed none too eager to declare themselves, perhaps taken aback by the horde of news reporters there to greet them. One visitor, who would give only a first name, Ed, said he had been in pain since being shocked on the job for an electric company in 2003.

Not for them the whimsicality of the Magical Mystery Tour and other happy drug allusions of the ’60s. The opening was all business, down to the pious name, the Greenleaf Compassion Center. Visits were by appointment only, and a uniformed security guard stood outside the front door at 395 Bloomfield Ave., checking identifications before letting anyone into the black glass storefront, which made it all but impossible to see inside.

The operators of the dispensary did step out for a cigarette break, strictly tobacco.

The chief executive, Joseph Stevens, 40, said he had been a funeral director in Nutley for 12 years, where he was inspired to go into his current business by seeing firsthand the suffering of families whose relatives had died of painful diseases.

“It’s a comforting experience,” Stevens said, describing how patients had reacted to the dispensary. “They’ve lived in the shadows for so many years.” He said this was a place where they could get the therapy they needed yet “feel safe, have no fear of prosecution, and go home.”

His business partner, Julio Valentin Jr., 43, the chief operating officer, is a former Newark police officer who had run a Montclair establishment, the Cafe Eclectic, known for its funky ambience, up the street for 15 years.

Valentin said the town had been very welcoming, and stressed that the dispensary was “not going to be your typical head shop or mom-and-pop shop. This is a professional program.” He had designed the interior decor, which he described as “beautiful,” with “earth tones, a soothing atmosphere, leather couches, like an upscale doctor’s office.”

The partners said they had been friends for 32 years, and Stevens said they were growing the marijuana in a “very clean, very secure” warehouse. Asked if they had ever personally smoked their product, Stevens said, “No, I don’t. I just don’t like it,” but quickly added that if he were sick, that would be a different story.

Valentin gave a theatrical shrug and a sheepish smile.

They said they received several patients Thursday and dispense between a half ounce and two ounces of marijuana to each of them. Two inspectors from the state Health Department also paid a monitoring visit.

Montclair is known as a suburban version of Park Slope, Brooklyn, a town with an haute bohemian feel, home to many writers and journalists. But the dispensary is in a down-at-the-heels section of the commercial strip reserved for offbeat and pariah businesses: a string of ethnic restaurants; a cigar lounge; a head shop with an adults-only section in back; and right next door, an abortion clinic with a forbidding concrete facade.

Passers-by reacted mostly enthusiastically to the dispensary on its first day.

Looking on in fascination, Francis David Robinson, or FDR, as he likes to be called, a debonair 74-year-old who runs errands for tips, said, “Could I get a freebie?”

Told that his glaucoma was one of the conditions that could qualify, along with diseases like terminal cancer and muscular dystrophy, he said dismissively, “I hate doctors.”

One person unabashedly rejoiced in the arrival of the dispensary. Surrounded by colorful glass bongs, Candi Cooper, the manager of the combination head shop and adult shop, called the Montclair Video Boutique, with peace signs in every “O” in its name on the sign out front, said she looked forward to a fruitful relationship.

“It’s kind of like a hospital,” she said, of the dispensary. “You get morphine and Dilaudid at the hospital. Does that make the place that sells medical equipment to put the morphine in a bad thing? No.”