TARPON SPRINGS — For months, the Clearwater Marine Aquarium worked quietly in an isolated corner of Fred Howard Park to build a brand new structure, which it meant to keep a secret until it was set to be unveiled at the end of the summer.

Then, last week, five pilot whales swam ashore at Redington Beach, spurring a full-scale rescue effort by the aquarium, the National Oceanic and Atmospheric Administration and volunteer beachgoers. Suddenly the new facility, where two of the whales were rehabilitated, was public knowledge.

"The whales kind of stole the show," Clearwater Marine Aquarium CEO David Yates said.

The new center, completed last month, was built for exactly this purpose: to provide critical care to marine mammals that become beached or stranded in shallow waters in the gulf. Because it will hold animals receiving medical attention on an emergency basis, it will not be open to the public.

The Tarpon Springs facility will allow staff to treat mammals taken from the wild in a quarantined environment away from the aquarium, where a communicable illness brought in from the ocean could be deadly to animals in captivity. Previously, the aquarium has quarantined portions of its main building to treat injured animals, a less efficient process, according to Yates.

"We rescued and rehabbed a dolphin about five years ago in our current facility but we had to cordon it off," he said. "And we actually had to turn away a number of animals over the years."

The facility's first patients were two of the five pilot whales stranded near Redington Beach last week. After volunteers helped haul the whales across the beach, they were carried in a truck to the Tarpon Springs center, where a hydraulic crane lifted them into an open-air, 75,000-gallon pool measuring 40 feet across.

While there, the two whales were tested for infections and other ailments, and were given vitamin injections to prevent muscle cramping. Within 72 hours, aquarium veterinarians determined the whales were fit to re-enter the wild, and on Thursday they were released back into the gulf, where the three other whales had been released three days prior.

Satellite data shows the five whales making headway in the right direction — away from shore — since being released.

As of Monday morning, one week after they were stranded, the three whales released the day of the rescue had reached the continental shelf about 100 miles west of Pinellas County. The edge of the shelf marks the start of the deep ocean, where pilot whales typically live. Meanwhile, the two whales released Thursday made it 40 miles offshore by Monday morning and were headed in the direction of the remaining three.

"This was a success story in terms of how we were able to treat these whales, and it's exactly what the facility is for," Yates said.

Whale strandings are rare, according to Yates, and the facility is more likely to treat dolphins on a regular basis. The aquarium is also in the process of building a new, 150,000 gallon tank at the facility, which will be used for manatee rehabilitation beginning next year.

Yates said the aquarium is raising money to cover unforeseen costs of the effort to rehabilitate the whales. The aquarium is seeking $20,000 to pay for medical tests, the cost of transporting the whales out to sea, a crane the aquarium had to rent to lift the whales, and overtime pay for staff that worked to care for the whales while they were held at the new facility.

The land for the new facility in Fred Howard Park was provided by Pinellas County and the city of Tarpon Springs, Yates said. Construction began on the project in September 2018 and the overall cost for the center was $1.3 million, according to Yates.

Contact Aaron Holmes at (706) 347-1880 or aholmes@tampabay.com. Follow @aaronpholmes.