The humpback whale nicknamed Timmy, whose weeks-long struggle in the shallow waters of the Baltic Sea captivated Germany and prompted a dramatic, polarizing rescue, was found dead Thursday off the Danish island of Anholt, the Danish Environmental Protection Agency confirmed Saturday. The confirmation, made after a tracking device was recovered from the carcass, ended a saga that began when the 30-foot juvenile was first spotted off Germany’s Baltic coast on March 3, far from its natural Atlantic Ocean habitat.

Danish authorities retrieved the device, still fastened to the whale’s back, on Saturday. “It can now be confirmed that the stranded humpback whale near Anholt is the same whale that was previously stranded in Germany and was the subject of rescue attempts,” said Jane Hansen, head of division at the Danish Environmental Protection Agency. She added that “the position and appearance of the device confirm that this is the same whale that had previously been observed and handled in German waters.”

The private rescue initiative that had spearheaded the effort separately confirmed, through German news agency dpa, that the tracking device’s number matched the one attached to the whale. It was not immediately possible to say conclusively what caused the animal’s death.

The whale’s ordeal began when it wandered into the Baltic Sea. On March 3, it was first seen swimming off the coast near Timmendorfer Strand, a German resort town. By late March, it had become stranded in shallow water and was freed with the help of an excavator, but soon ran aground again nearby. German media produced dayslong livestreams, and the plight of the whale — nicknamed Timmy or “Hope” — drew fervent public attention.

As the whale’s condition deteriorated in early April, experts said they had given up hope and expected it to die in the inlet where it was trapped. That prognosis ignited controversy. Privately funded rescuers, backed by public protests and online campaigns, pressed for a final intervention. Some scientists warned that further rescue efforts would cause the already ailing and exhausted animal severe stress. The regional government in Mecklenburg-Western Pomerania ultimately allowed the private initiative to proceed, and on May 2 the whale was pulled onto a flooded barge and transported about 70 kilometers north toward the North Sea, near the Danish town of Skagen. It was released there, but two weeks later it was found dead on Anholt.

Mecklenburg-Western Pomerania’s environment minister, Till Backhaus, said Saturday that the effort had given the whale “a last chance to recover its freedom and health.” He said it will be important to learn “the best possible lessons” from the episode. Backhaus stressed that “acquiescing to the rescue attempt doesn’t constitute criticism of science” and added: “I think it is absolutely human to use even the smallest chance when a life is at stake.”

No formal plans have been made to remove the whale or to perform a necropsy, Hansen said, adding that it is not currently considered a hazard in the area. She cautioned the public to stay away from the carcass because of the possibility it may carry diseases and other reasons.