Does That Cat Have O.C.D.? (New York Times)

It was love at first pet when Laurel Braitman and her husband adopted a 4-year-old Bernese mountain dog, a 120-pound bundle of fur named Oliver.

The first few months were blissful. But over time, Oliver’s troubled mind slowly began to reveal itself. He snapped at invisible flies. He licked his tail until it was wounded and raw. He fell to pieces when he spied a suitcase. And once, while home alone, he ripped a hole in a screen and jumped out of a fourth-floor window. To everyone’s astonishment, he survived.

Oliver’s anguish devastated Dr. Braitman, a historian of science, but it also awakened her curiosity and sent her on an investigation deep into the minds of animals. The result is the lovely, big-hearted book “Animal Madness,” in which Dr. Braitman makes a compelling case that nonhuman creatures can also be afflicted with mental illness and that their suffering is not so different from our own.

In the 17th century, Descartes described animals as automatons, a view that held sway for centuries. Today, however, a large and growing body of research makes it clear that animals have never been unthinking machines.

ANIMAL MADNESS How Anxious Dogs, Compulsive Parrots and Elephants in Recovery Help Us Understand Ourselves. By Laurel Braitman. Simon & Schuster. 384 pages. $28.CreditSonny Figueroa/The New York Times

We now know that species from magpies to elephants can recognize themselves in the mirror, which some scientists consider a sign of self-awareness. Rats emit a form of laughter when they’re tickled. And dolphins, parrots and dogs show clear signs of distress when their companions die. Together, these and many other findings demonstrate what any devoted pet owner has probably already concluded: that animals have complex minds and rich emotional lives.

Unfortunately, as Dr. Braitman notes, “every animal with a mind has the capacity to lose hold of it from time to time.”

Take Gigi, a female gorilla who developed what looked like panic attacks after being terrorized by a younger male. Whenever she saw her tormentor, she “seemed to shut down, rocking and trembling,” Dr. Braitman writes. Many other beasts round out the miserable menagerie, including Sunita, a tiger with stress-induced facial tics; Charlie, a macaw who plucked out all her feathers; and Gus, a polar bear who swam endless figure eights — for as many as 12 hours a day — in his pool at the Central Park Zoo.

Dr. Braitman and the experts she consults are careful about how they interpret this behavior. For example, although a dog’s nonstop tail-licking may resemble the endless hand-washing of a human with obsessive-compulsive disorder, one veterinary behaviorist points out that because she cannot prove that dogs are having obsessive thoughts, she prefers a diagnosis of “compulsive disorder” instead.

Still, it’s clear that the animals are suffering, and the triggers are often the same sorts of stress and trauma that can cause breakdowns in humans: a natural disaster, abuse, the loss of a loved one. And we’re not the only species that bears the burden of war; some of the military dogs that served in Iraq and Afghanistan display the same PTSD-like symptoms that afflict their human colleagues.

Dr. Braitman does not shy away from controversial topics — most notably, the question of whether animals can commit suicide. Charlie, the feather-plucking macaw, died when she fell out of a tree and onto a metal stake in the ground, prompting her owner to wonder if the bird had deliberately brought about her own demise. “Suicide” is a loaded word, and Charlie’s story is unconvincing, but animals can certainly engage in self-harming behaviors, from repeatedly banging their heads against walls to simply refusing to eat.

Animals “may have fewer tools available to them to inflict mortal wounds and also lack humanity’s sophisticated cognitive abilities to plan their own ends, but they can and do harm themselves,” Dr. Braitman writes. “Sometimes they die.”

Throughout the book, she argues that anthropomorphism — or the assignment of human traits to other species — can serve a useful purpose, especially if we “anthropomorphize well.” She writes, “Instead of self-centered projection, anthropomorphism can be a recognition of bits and pieces of our human selves in other animals and vice versa.”

Though we may never know for sure what parrots or polar bears are feeling, “making educated guesses about animal emotions” is often the first step in alleviating their pain. Healing troubled animal minds is now a bona fide industry, populated with dog behaviorists, cat whisperers, elephant monks and horse massagers.

For some animals, behavioral therapy, environmental enrichment or companionship is enough to ease the agony. Others may need a pharmaceutical assist — from Prozac, Valium, Thorazine or one of the many psychiatric drugs now available to creatures throughout the animal kingdom.

“Prozac Nation has been offering citizenship to nonhumans for decades,” Dr. Braitman writes. Gigi, the terrorized gorilla, received a round of Xanax and Paxil and eventually recovered (mostly) with the help of a psychiatrist and a zookeeper who never gave up on her.

Though humans are a leading cause of animal unhappiness — captivity alone causes many problems, even in the absence of outright neglect or abuse — “Animal Madness” is also brimming with compassion and the tales of the many, many humans who devote their days to making animals well.