There are many more gorillas and chimpanzees than previously believed, new research finds. Nonetheless, their numbers are rapidly declining.

All great apes are protected species under national and international conventions; it is illegal to kill or capture them, or to buy and sell their body parts. But they are threatened by illegal poaching and the destruction of their habitats. And various diseases, particularly Ebola, have been devastating for the animals.

Gorillas and chimpanzees are found in western and central Africa. About 12 percent of their habitat is legally protected from development.

In an 11-year project, the Wildlife Conservation Society, in collaboration with other organizations, surveyed nests at 59 sites in five countries. The results appear in the journal Science Advances.

As of 2013, the researchers concluded, there were 361,919 weaned gorillas and 128,760 weaned chimpanzees in the region. Previous estimates had ranged as low as 150,000 gorillas and 70,000 chimpanzees.

Sixty percent of gorillas and 43 percent of chimpanzees live in Congo; Gabon is home to 27 percent of gorillas and 34 percent of chimpanzees. Most of these animals live outside protected areas.

Ape populations declined where human populations increased, near communities that consume apes as food, and where forests are thinned out. Mortality in Ebola outbreaks, which occurred before the current survey was undertaken, has ranged as high as 95 percent.

Fiona Maisels, a co-author of the study and a conservation scientist at the conservation society, said that while older estimates provided a range, these new numbers have “statistically robust precision.” The researchers surveyed more than 70,000 square miles — an area about the size of the state of Washington.

Chimpanzee numbers are declining, although it is difficult to specify how fast. With gorillas, the rate of decline is known: 2.7 percent a year since 2013. Dr. Maisels said that if this rate continues through 2020, only 300,000 gorillas will remain.

“Apes are us,” Dr. Maisels said. “They’re part of a system that we have damaged quite badly, and it’s our responsibility to try and stop that damage.”