TWELVE MILES OFF PROVINCETOWN — The dark waters began to roil. Silently, two black, 70-ton leviathans emerged from the depths of Cape Cod Bay, skimmed the surface, then quickly slipped back into the sea. Scientists in a nearby boat tracked their “fluke prints” — the large surface swirls created from their underwater tail sweeps — but soon lost the watery trail of two of the world’s rarest whales.

For years, scientists have sounded a dirge for the North Atlantic right whale. Its population stalled around 300 in the 1990s, pushing some researchers to make mournful extinction predictions for the mysterious, 45-foot-long creatures that come to feed and frolic every spring off Cape Cod.

Whale population steadily climbs

Now, the critically endangered population has hit 500 whales, probably for the first time in centuries — a poignant milestone for a marine mammal whose numbers dwindled to perhaps a few dozen after being hunted relentlessly for their oil and baleen from the 11th to the early 20th centuries. Researchers, while joyful, say that number is still tiny — and they remain deeply concerned about recent environmental changes, including global warming, that spell uncertainty for the creatures’ future.

“Five hundred whales make you want to sing,’’ said Charles “Stormy” Mayo, senior scientist at the Provincetown Center for Coastal Studies, which studies the whales. “But you have to hold your breath when you sing. We have a substantially changing ocean. We don’t know what the future holds.”

Last Monday, he and his staff aboard the research vessel Shearwater scanned the horizon for spouts from the whales’ blowholes. An airplane flew transects above, searching for dark shadows in the relatively small bay and radioing their locations to the boat.

Scientists don’t know what a healthy right whale population even looks like, but they suspect it is in the thousands or even tens of thousands. Today, the population is increasing about 2.5 percent a year — far better than the 1990s — but hardly the 6 or 7 percent researchers would like to see.

The reasons for the increase are likely myriad. Ships have slowed down and moved to avoid the creatures. Fishing lines have been developed that allow some whales to avoid being tangled. A number of good feeding years — the animals can consume tiny shrimplike plankton at a rate of 125 pounds an hour — probably helped with a dramatic increase in calves starting around 2001.