Black bears are coming back, returning to previous numbers before humans started taking over their forest homes and hunting them.

Research published in the Journal of Wildlife Management found in southern New York State, in the mountain ranges near the Pennsylvania border, the American black bear population has been growing and expanding its territory in the last few decades. Scientists snagged multiple hairs from more than 250 bears over a couple of years and analyzed their DNA to learn more about the population density and identify the pattern in which their numbers are changing. The genetic analysis showed there was a black bear for roughly every 3 square miles in that region, with a variation in the density based on latitude — the difference in the more northern parts of their range showing that they are expanding in that direction.

Read: Sharks Are on the Rebound in the Atlantic Ocean

“Elevation and the amounts of forest, crop and developed land-cover types did not influence density, suggesting that bears are using a diversity of resources in this heterogeneous landscape,” the study says. That “implies a possible lack of constraints for further northern expansion of the black bear range.”

It’s a big change for the animals. Lead study author Catherine Sun, a doctoral student at Cornell University, said black bear numbers in New York were low for decades before they started to rebound.

Even before the 20th century, black bears lost a lot of “traditional forested habitat due to human settlement and conversion of forests to farmlands,” she told International Business Times. And they were hunted.

black-bears-1972307_1920 Black bears are on the rise in New York, where they previously were kicked out of their homes and hunted as humans settled the area. Photo: Pixabay, public domain

Later environmental measures like regulated hunting have helped the species boost their population, and “their population growth is a rebound from unnatural declines in their numbers,” Sun said.

The New York State Department of Environmental Conservation is still using black bear hunting as a tool for managing the population.

Despite the black bears being a native species to New York, their growth holds the potential for conflict.

The northern parts of the state where black bears are expected to keep expanding “reaches into areas that have higher human populations,” co-author Angela Fuller, a professor of natural resources, said in a Cornell University statement.

Read: Polar Bears Need Arctic Wind to Hunt, But the Wind Is Changing

Sun said that has something to do with why the researchers studied the bears.

“A major motivation to studying the growing black bear population is because the frequency and intensity of bears interacting with humans has been increasing,” Sun said.

Those interactions can happen in the forest, but they also have been occurring in more urban areas as well, some of it stemming from the bears looking for food. They eat just about anything, the DEC says, including more natural foods like berries, fruits, nuts and insects as well as bird seed, trash and pet food.

According to Cornell University, the next step is a project called iSeeMammals in which people in the area, like hikers and hunters, can submit information about bear sightings or other data to help track the population.