Finally, some good environmental news. After being almost wiped out by whaling in the 20th century, a humpback whale population off the coast of South America has come back from the brink of extinction.

In the late 1950s there were only 440 western South Atlantic humpbacks left.

Protections were put in place in the 1960s. At first they didn't seem to be rebounding, but a study published Wednesday finds that to the surprise of scientists the population is now up to an estimated 25,000 whales. That's almost as many as researchers estimate there were before whaling began in the 1700s.

Scientists were thrilled to realize how fast and how well the population has recovered after whaling finally stopped for good in the 1970s.

“This is a clear example that if we do the right thing then the population will recover. I hope it serves as an example that we can do the same thing for other animal populations,” said Alexandre Zerbini, a whale expert with the Seattle Marine Mammal Laboratory of the National Marine Fisheries Service, which is part of the National Oceanic and Atmospheric Administration. He is the lead author on a research paper documenting the whales' recovery.

It wasn't looking good for the humpbacks

For a long time it looked as if the western South Atlantic humpbacks were never going to recover from almost two centuries of whaling. A survey in 2006 by the International Whaling Commission conducted from planes found the population had only recovered by 30%.

To get a better sense of how they were doing, Zerbini and other researchers set out in a ship in 2008 and then again in 2012, zigzagging across the whales' breeding and feeding grounds off the eastern coast of South America and counting whales.

What they found came as a welcome surprise — the humpbacks in the area were thriving.

“I expected the recovery to be higher than we’d estimated in 2006 but I wasn’t expecting the almost full recovery we found,” Zerbini said.

The scientists estimate the humpbacks are at about 93% of their pre-whaling population.

“It wasn't until we did the first proper assessment at the start of the 2000s that we realized just how well they were recovering," he said.

The research was published Wednesday in the journal Royal Society Open Science, a peer-reviewed scientific journal based in London. It was funded by the Pew Bertarelli Ocean Legacy project, which works to create marine reserves.

Humpback whales can grow to as long as 50 feet and weigh up to 30 tons. It's believed they live to be up to 80 years old.

There are 16 populations of humpbacks around the world. Four of them are considered endangered and one is threatened.

The global population has been rebounding since whaling was banned in the 1970s. It's estimated there are currently between 120,000 and 150,000 humpbacks. Humans are still whale's biggest threat, either when they're struck by ships or become entangled in commercial fishing gear.

Down to just 440 whales

The western South Atlantic humpbacks were the first major target of commercial whaling in the Antarctic and it's believed as many as 25,000 of the whales were killed between 1904 and 1916, the researchers said.

The population hit a low of 440 in the late 1950s. Whaling bans in the 1960s allowed it to begin to grow again and by 1967 there were an estimated 650 in this group. However, that year an illegal Soviet whaling fleet killed 189, once again bringing it below 500 individuals.

Since then a worldwide ban on whaling has allowed the iconic mammals to rebound.

"We're seeing more and more humpbacks every year. They're coming back," said Zerbini.

The concern now is that global warming seems to be shifting where krill, the tiny crustaceans that are the humpback's main food, live. That could affect their future.

"It appears that the krill are moving southwards with global warming, and that could force the whales to compete with penguins and fur seals for food," he said.