When Michael Nichols first photographed elephants in the lowland forests of the Central African Republic in 1991, he only caught fleeting moments of them, and at great peril. These sensitive behemoths were so afraid of ivory poachers hunting them down, they thundered off at the slightest hint of human activity.

It took him 16 years to encounter elephants who were not fearful of humans, on the savannah of Kenya’s Samburu National Reserve, where they were protected and used to tourists. He spent two years there photographing a group of 600 elephants, gradually comprehending their complex relationships, intelligence and compassion.

When one family mourned the death of a female, the elephants approached and surrounded the corpse, touched it with their trunks, and started swaying back and forth. Matriarchs from nearby elephant families joined in.

“They go to the corpse and they won’t leave it,” Mr. Nichols said. “Even when it’s just bones. Once a year they’ll visit the bones and hold them with their trunk. I would call that mourning.”

His 20-year project, “Earth to Sky,” is being published by Aperture this week. It is a stunningly beautiful book, whose images, many of them taken while on assignment for National Geographic magazine, reflect experiences that had a profound effect on Mr. Nichols.

“These are the most caring and sentient creatures on earth,” he wrote in the book, “yet they suffer so horribly at the hand of man.”

He was helped in the savannah by Daniel Lentipo, a Samburu tribesman who had worked with a researcher from the environmental organization Save the Elephants. Mr. Lentipo could spot and identify almost any elephant, even from a great distance, and knew the individual names that had been bestowed on each. Mr. Nichols and his guide followed a family led by a matriarch named Navajo.

Normally, elephants sleep standing up to be alert to impending danger. But these ones felt comfortable enough that in the middle of the night the whole family lay down and went to sleep “just snoring and farting” around the two men.

Michael Nichols/National Geographic

Mr. Nichols saw complex societal relationships unfold and photographed elders teaching and taking care of young orphans. He also noticed that these elephants were so sensitive to their environment, it was as if they were carrying around an internal weather station. Not to mention a memory — you guessed it — as good as an elephant’s.

“The old ladies got to know where they found water 20 years ago during a drought,” he said of the matriarchs. “Elephants are passing on knowledge just like indigenous tribes would or we might today.”

If only humans were as faithful to the past. The volume includes Mr. Nichols’s elegiac black and white photographs (Slides 6 through 10) of a massacre by ivory poachers in Chad in 2006 that he says was the beginning of a full-scale elephant slaughter that continues to today. With each tusk fetching up to $6,000, tens of thousands of elephants throughout Africa are killed for their tusks.

“Ivory simply must be devalued,” Mr. Nichols wrote. “Those who buy it and use it and carve it must be shamed. Elephants are perceptive, conscious and responsive animals; they cannot be terrorized and massacred by a world that calls itself civilized. We have to forget about the absurd indulgence of ivory — a useless status symbol — and put our focus and resources into the far more complex problem of how elephants and humans can share land in an overtaxed continent.”

He sees this as more than a conservation issue. Both in the jungles and on the plains, ecosystems depend on elephants to clear the land for other animals to use. But there is an “almost spiritual” experience, he said, in seeing large herds of elephants walking freely across Africa’s plains.

“Elephants should be here just because they need to be here,” he said. “The earth is not the earth without them.”

Michael Nichols/National Geographic

Michael Nichols’s “ Earth to Sky ” images will be on view at the Anastasia Photo gallery on Orchard Street in Manhattan from Sept. 25 through Oct. 30. There will be an opening reception on Oct. 7.

Follow @JamesEstrin and @nytimesphoto on Twitter. Lens is also on Facebook.