Ram Dass later wrote that he tried psilocybin, the compound found in hallucinogenic mushrooms, in Leary’s living room.

“I peered into the semidarkness and recognized none other than myself in cap and gown and hood,” he wrote. “It was as if that part of me, which was a Harvard professor, had separated or dissociated itself from me.”

The experiments got him and Leary kicked out of Harvard in 1963.

“It was a little too sensational,” Ram Dass said in 1998. “We were the starters of it.”

He and Leary retreated to an upstate New York mansion that drew Beat Generation figures Ginsberg, William Burroughs and Jack Kerouac.

By the late 1960s, LSD and other hallucinogens had become part of pop culture and a rite of passage for many young Americans.

But Alpert eventually sought a way to reach a state of enlightenment without drugs. Following Ginsberg’s advice, he headed to India in 1967, where he met the man who became his guru, Neem Karoli Baba.

There, his guru introduced him to yoga, meditation, Buddhism and Sufism, and gave him the name Ram Dass, Hindi for “servant of God.” (He is often called Baba Ram Dass; “baba” is an honorary title.)

Ram Dass wrote “Be Here Now” when he returned to the United States. Around the same time, he told The New York Times that he had turned away from drugs, saying: “I don’t want to break the law, since that leads to fear and paranoia.”

In 1974, Ram Dass founded the Hanuman Foundation, which set up programs such as the Prison Ashram Project to introduce inmates to spirituality. He also helped create the Berkeley-based Seva Foundation, which works to prevent blindness and helps community groups in developing countries. His Love Serve Remember Foundation is dedication to preserving his teachings and those of Neem Karoli Baba.

Ram Dass lived for many years in the quiet Marin County town of San Anselmo, California, about 20 miles north of San Francisco, surrounded by the markers of his life straddling East and West: Japanese prints and statues of Buddha, seashells from the South Pacific and a well-used player piano.

In later years, he moved to Woodside, California. More recently, he was based in Maui.

He said his 1997 stroke brought physical and spiritual suffering, but that he came to see the suffering as a source of insight that he could share with others facing their own battles with illness and aging.

“It’s brought out new aspects of myself and aspects of my relationship to the world,” he said in 1998. The stroke has gotten me into a stage of life — this is a stage close to death, a stage which is inward.”

After regaining his speech, Ram Dass returned to the lecture circuit, starting by touring Northern California sharing tales of what he called his state of “heavy grace.”

“All illnesses are part of the passing show,” he told the San Francisco Chronicle in 2004. “You are not just your body. You are the witness of your body.”

He had a falling out with Leary in the 1970s after rumors surfaced that the latter, jailed on drug and prison-break charges, offered to provide authorities with information on others involved in the drug culture in exchange for a lighter sentence.

But the pair had reconciled in the years before Leary’s death in 1996, joking back and forth and praising one another as they made joint appearances at lectures. When Leary was on his deathbed, Ram Dass came to visit after Leary asked for advice on how best to let go of life.

“The mythic level that Timothy and I lived at was that we were adventurers,” he said in the 2014 documentary, “Dying to Know: Ram Dass & Timothy Leary.”

Although speaking of Leary, Ram Dass added an epithet that also could be his own: “If you have identified with your soul when you are alive, death is just another moment.”