A blue shark that was spotted in shallow waters at a beach off the coast of Mallorca in Palma, in the Balearic Islands in Spain, was captured Sunday after it caused panic over the weekend that led to the evacuation of a huge number of British holiday-makers.

The shark was first spotted by tourists on Saturday as it swam along the beaches at Cala Major and Can Pastilla, near the Mallorcan capital of Palma. Videos and pictures taken by the panic-stricken tourists showed the animal gliding through the crystal clear water, just a few meters away from the bathers, who ran to the shore for safety as soon as the shark was seen.

ReadShark Attacks Increasing On California Coast Beaches In 2017

The 8-feet-long blue shark was spotted again on Sunday with a major head wound that was believed to have been caused by a harpoon. The beach was closed after the shark was spotted near the shallow water and as it washed ashore on Sunday and struggled on the sand. Lifeguards pulled it out from the waters and handed it over to wildlife experts in the nearby Palma aquarium. Staff there found a hook in the shark's mouth and decided to put the shark down in order to rid it of unnecessary suffering. An aquarium employee also said the animal was given a sedative to decrease the pain before putting it down.

“After a close examination by experts, a hook was found inside its mouth which had caused it irreversible damage,” an aquarium employee said.

“In order not to prolong the unnecessary suffering of the fish, (it has been euthanized),” the rescue team said, according to the local newspaper El Diario de Mallorca.

As soon as the shark was sighted on Sunday, lifeguards raised the red flag, cleared the beach and closed it immediately. Following this, a search for the shark was conducted in the area  in motorboats. It was located and captured by Sunday afternoon, according to the Guardian.

Officials were not sure if the head injury on the shark happened before or after it was seen near the beach.

ReadWATCH: Massive Shark Appears Among Swimmers In Shallow Water On Alabama Coast

One witness of the incident posted an account of the scenario on Facebook. “Everyone out of the water!” she wrote. “The lifeguards were shouting that the red flag had been raised here on the Cala Major beach and that there were three sharks – the smallest of which was a meter-and-a-half long.”

She added: “What a pity that they have to come so close because we’re destroying their ecosystem and they have to survive.”

Similar instances have occurred earlier too in the region. A blue shark was said to have attacked a swimmer near a popular holiday beach in Ibiza in May. The person who was attacked had to undergo emergency hospital treatment. In July 2016, a man was bitten on the hand by a blue shark while swimming off the Costa Blanca in southeast Spain.

Generally, blue sharks are said to feed on fish and are rarely seen close to the shore and thus pose minimal threat to humans. They are one of the most common sharks found in the Mediterranean.